diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..2e2ac65 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,27 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + +jobs: + deploy: + permissions: + contents: write + pages: write + id-token: write + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: ./ + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7bcdee0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 lin onetwo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4415d36 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Starbound-Character-Generator + +![图片](https://github.com/user-attachments/assets/11d7fbb4-16ff-4fab-9dfc-0953d91b241c) + +Using asset from [Starbound](https://store.steampowered.com/app/211820/Starbound/) and [Cutebound](https://steamcommunity.com/sharedfiles/filedetails/?id=761242493&searchtext=cute), only for learning properse. diff --git a/images/sheets/apex/body-female.png b/images/sheets/apex/body-female.png index 586b8d1..732d6f1 100644 Binary files a/images/sheets/apex/body-female.png and b/images/sheets/apex/body-female.png differ diff --git a/images/sheets/apex/head-female.png b/images/sheets/apex/head-female.png new file mode 100644 index 0000000..e783ccd Binary files /dev/null and b/images/sheets/apex/head-female.png differ diff --git a/images/sheets/apex/head-male.png b/images/sheets/apex/head-male.png new file mode 100644 index 0000000..e3bc7c9 Binary files /dev/null and b/images/sheets/apex/head-male.png differ diff --git a/images/sheets/avian/body-female.png b/images/sheets/avian/body-female.png index 0f55d78..0a00bcf 100644 Binary files a/images/sheets/avian/body-female.png and b/images/sheets/avian/body-female.png differ diff --git a/images/sheets/avian/body-male.png b/images/sheets/avian/body-male.png index 67323b1..92539bf 100644 Binary files a/images/sheets/avian/body-male.png and b/images/sheets/avian/body-male.png differ diff --git a/images/sheets/avian/head-female.png b/images/sheets/avian/head-female.png new file mode 100644 index 0000000..48cdd8a Binary files /dev/null and b/images/sheets/avian/head-female.png differ diff --git a/images/sheets/avian/head-male.png b/images/sheets/avian/head-male.png new file mode 100644 index 0000000..8093739 Binary files /dev/null and b/images/sheets/avian/head-male.png differ diff --git a/images/sheets/floran/body-female.png b/images/sheets/floran/body-female.png index 22f1867..ccf973c 100644 Binary files a/images/sheets/floran/body-female.png and b/images/sheets/floran/body-female.png differ diff --git a/images/sheets/floran/body-male.png b/images/sheets/floran/body-male.png index 60b94f4..b00dd74 100644 Binary files a/images/sheets/floran/body-male.png and b/images/sheets/floran/body-male.png differ diff --git a/images/sheets/floran/head-female.png b/images/sheets/floran/head-female.png new file mode 100644 index 0000000..56b0bc4 Binary files /dev/null and b/images/sheets/floran/head-female.png differ diff --git a/images/sheets/floran/head-male.png b/images/sheets/floran/head-male.png new file mode 100644 index 0000000..6ee6e92 Binary files /dev/null and b/images/sheets/floran/head-male.png differ diff --git a/images/sheets/robot/armor-craftsmen-backSleeve.png b/images/sheets/glitch/armor-craftsmen-backSleeve.png similarity index 100% rename from images/sheets/robot/armor-craftsmen-backSleeve.png rename to images/sheets/glitch/armor-craftsmen-backSleeve.png diff --git a/images/sheets/robot/armor-craftsmen-chestFemale.png b/images/sheets/glitch/armor-craftsmen-chestFemale.png similarity index 100% rename from images/sheets/robot/armor-craftsmen-chestFemale.png rename to images/sheets/glitch/armor-craftsmen-chestFemale.png diff --git a/images/sheets/robot/armor-craftsmen-chestMale.png b/images/sheets/glitch/armor-craftsmen-chestMale.png similarity index 100% rename from images/sheets/robot/armor-craftsmen-chestMale.png rename to images/sheets/glitch/armor-craftsmen-chestMale.png diff --git a/images/sheets/robot/armor-craftsmen-frontSleeve.png b/images/sheets/glitch/armor-craftsmen-frontSleeve.png similarity index 100% rename from images/sheets/robot/armor-craftsmen-frontSleeve.png rename to images/sheets/glitch/armor-craftsmen-frontSleeve.png diff --git a/images/sheets/robot/armor-craftsmen-pantsFemale.png b/images/sheets/glitch/armor-craftsmen-pantsFemale.png similarity index 100% rename from images/sheets/robot/armor-craftsmen-pantsFemale.png rename to images/sheets/glitch/armor-craftsmen-pantsFemale.png diff --git a/images/sheets/robot/armor-craftsmen-pantsMale.png b/images/sheets/glitch/armor-craftsmen-pantsMale.png similarity index 100% rename from images/sheets/robot/armor-craftsmen-pantsMale.png rename to images/sheets/glitch/armor-craftsmen-pantsMale.png diff --git a/images/sheets/robot/armor-merchant-backSleeve.png b/images/sheets/glitch/armor-merchant-backSleeve.png similarity index 100% rename from images/sheets/robot/armor-merchant-backSleeve.png rename to images/sheets/glitch/armor-merchant-backSleeve.png diff --git a/images/sheets/robot/armor-merchant-chestFemale.png b/images/sheets/glitch/armor-merchant-chestFemale.png similarity index 100% rename from images/sheets/robot/armor-merchant-chestFemale.png rename to images/sheets/glitch/armor-merchant-chestFemale.png diff --git a/images/sheets/robot/armor-merchant-chestMale.png b/images/sheets/glitch/armor-merchant-chestMale.png similarity index 100% rename from images/sheets/robot/armor-merchant-chestMale.png rename to images/sheets/glitch/armor-merchant-chestMale.png diff --git a/images/sheets/robot/armor-merchant-frontSleeve.png b/images/sheets/glitch/armor-merchant-frontSleeve.png similarity index 100% rename from images/sheets/robot/armor-merchant-frontSleeve.png rename to images/sheets/glitch/armor-merchant-frontSleeve.png diff --git a/images/sheets/robot/armor-merchant-pantsFemale.png b/images/sheets/glitch/armor-merchant-pantsFemale.png similarity index 100% rename from images/sheets/robot/armor-merchant-pantsFemale.png rename to images/sheets/glitch/armor-merchant-pantsFemale.png diff --git a/images/sheets/robot/armor-merchant-pantsMale.png b/images/sheets/glitch/armor-merchant-pantsMale.png similarity index 100% rename from images/sheets/robot/armor-merchant-pantsMale.png rename to images/sheets/glitch/armor-merchant-pantsMale.png diff --git a/images/sheets/robot/armor-noble-backSleeve.png b/images/sheets/glitch/armor-noble-backSleeve.png similarity index 100% rename from images/sheets/robot/armor-noble-backSleeve.png rename to images/sheets/glitch/armor-noble-backSleeve.png diff --git a/images/sheets/robot/armor-noble-chestFemale.png b/images/sheets/glitch/armor-noble-chestFemale.png similarity index 100% rename from images/sheets/robot/armor-noble-chestFemale.png rename to images/sheets/glitch/armor-noble-chestFemale.png diff --git a/images/sheets/robot/armor-noble-chestMale.png b/images/sheets/glitch/armor-noble-chestMale.png similarity index 100% rename from images/sheets/robot/armor-noble-chestMale.png rename to images/sheets/glitch/armor-noble-chestMale.png diff --git a/images/sheets/robot/armor-noble-frontSleeve.png b/images/sheets/glitch/armor-noble-frontSleeve.png similarity index 100% rename from images/sheets/robot/armor-noble-frontSleeve.png rename to images/sheets/glitch/armor-noble-frontSleeve.png diff --git a/images/sheets/robot/armor-noble-pantsFemale.png b/images/sheets/glitch/armor-noble-pantsFemale.png similarity index 100% rename from images/sheets/robot/armor-noble-pantsFemale.png rename to images/sheets/glitch/armor-noble-pantsFemale.png diff --git a/images/sheets/robot/armor-noble-pantsMale.png b/images/sheets/glitch/armor-noble-pantsMale.png similarity index 100% rename from images/sheets/robot/armor-noble-pantsMale.png rename to images/sheets/glitch/armor-noble-pantsMale.png diff --git a/images/sheets/robot/armor-peasant-backSleeve.png b/images/sheets/glitch/armor-peasant-backSleeve.png similarity index 100% rename from images/sheets/robot/armor-peasant-backSleeve.png rename to images/sheets/glitch/armor-peasant-backSleeve.png diff --git a/images/sheets/robot/armor-peasant-chestFemale.png b/images/sheets/glitch/armor-peasant-chestFemale.png similarity index 100% rename from images/sheets/robot/armor-peasant-chestFemale.png rename to images/sheets/glitch/armor-peasant-chestFemale.png diff --git a/images/sheets/robot/armor-peasant-chestMale.png b/images/sheets/glitch/armor-peasant-chestMale.png similarity index 100% rename from images/sheets/robot/armor-peasant-chestMale.png rename to images/sheets/glitch/armor-peasant-chestMale.png diff --git a/images/sheets/robot/armor-peasant-frontSleeve.png b/images/sheets/glitch/armor-peasant-frontSleeve.png similarity index 100% rename from images/sheets/robot/armor-peasant-frontSleeve.png rename to images/sheets/glitch/armor-peasant-frontSleeve.png diff --git a/images/sheets/robot/armor-peasant-pantsFemale.png b/images/sheets/glitch/armor-peasant-pantsFemale.png similarity index 100% rename from images/sheets/robot/armor-peasant-pantsFemale.png rename to images/sheets/glitch/armor-peasant-pantsFemale.png diff --git a/images/sheets/robot/armor-peasant-pantsMale.png b/images/sheets/glitch/armor-peasant-pantsMale.png similarity index 100% rename from images/sheets/robot/armor-peasant-pantsMale.png rename to images/sheets/glitch/armor-peasant-pantsMale.png diff --git a/images/sheets/robot/body-accessories.png b/images/sheets/glitch/body-accessories.png similarity index 100% rename from images/sheets/robot/body-accessories.png rename to images/sheets/glitch/body-accessories.png diff --git a/images/sheets/robot/body-backArm.png b/images/sheets/glitch/body-backArm.png similarity index 100% rename from images/sheets/robot/body-backArm.png rename to images/sheets/glitch/body-backArm.png diff --git a/images/sheets/glitch/body-female.png b/images/sheets/glitch/body-female.png new file mode 100644 index 0000000..93ec585 Binary files /dev/null and b/images/sheets/glitch/body-female.png differ diff --git a/images/sheets/robot/body-frontArm.png b/images/sheets/glitch/body-frontArm.png similarity index 100% rename from images/sheets/robot/body-frontArm.png rename to images/sheets/glitch/body-frontArm.png diff --git a/images/sheets/glitch/body-male.png b/images/sheets/glitch/body-male.png new file mode 100644 index 0000000..763fcc3 Binary files /dev/null and b/images/sheets/glitch/body-male.png differ diff --git a/images/sheets/glitch/head-female.png b/images/sheets/glitch/head-female.png new file mode 100644 index 0000000..f4ff451 Binary files /dev/null and b/images/sheets/glitch/head-female.png differ diff --git a/images/sheets/glitch/head-male.png b/images/sheets/glitch/head-male.png new file mode 100644 index 0000000..55c221d Binary files /dev/null and b/images/sheets/glitch/head-male.png differ diff --git a/images/sheets/human/body-female.png b/images/sheets/human/body-female.png index bc50f3f..c7bc72c 100644 Binary files a/images/sheets/human/body-female.png and b/images/sheets/human/body-female.png differ diff --git a/images/sheets/human/body-male.png b/images/sheets/human/body-male.png index 8ff5667..06ec68b 100644 Binary files a/images/sheets/human/body-male.png and b/images/sheets/human/body-male.png differ diff --git a/images/sheets/human/head-female.png b/images/sheets/human/head-female.png new file mode 100644 index 0000000..5c16873 Binary files /dev/null and b/images/sheets/human/head-female.png differ diff --git a/images/sheets/human/head-male.png b/images/sheets/human/head-male.png new file mode 100644 index 0000000..f15a035 Binary files /dev/null and b/images/sheets/human/head-male.png differ diff --git a/images/sheets/hylotl/body-female.png b/images/sheets/hylotl/body-female.png index 9387d28..5cb1f5d 100644 Binary files a/images/sheets/hylotl/body-female.png and b/images/sheets/hylotl/body-female.png differ diff --git a/images/sheets/hylotl/head-female.png b/images/sheets/hylotl/head-female.png new file mode 100644 index 0000000..f930fb7 Binary files /dev/null and b/images/sheets/hylotl/head-female.png differ diff --git a/images/sheets/hylotl/head-male.png b/images/sheets/hylotl/head-male.png new file mode 100644 index 0000000..d306b2d Binary files /dev/null and b/images/sheets/hylotl/head-male.png differ diff --git a/images/sheets/novakid/body-female.png b/images/sheets/novakid/body-female.png index f302cdf..5b86252 100644 Binary files a/images/sheets/novakid/body-female.png and b/images/sheets/novakid/body-female.png differ diff --git a/images/sheets/novakid/body-male.png b/images/sheets/novakid/body-male.png index 083cbb0..ab62c6e 100644 Binary files a/images/sheets/novakid/body-male.png and b/images/sheets/novakid/body-male.png differ diff --git a/images/sheets/novakid/head-female.png b/images/sheets/novakid/head-female.png new file mode 100644 index 0000000..fc814f4 Binary files /dev/null and b/images/sheets/novakid/head-female.png differ diff --git a/images/sheets/novakid/head-male.png b/images/sheets/novakid/head-male.png new file mode 100644 index 0000000..6a3887f Binary files /dev/null and b/images/sheets/novakid/head-male.png differ diff --git a/images/sheets/robot/body-female.png b/images/sheets/robot/body-female.png deleted file mode 100644 index dce4556..0000000 Binary files a/images/sheets/robot/body-female.png and /dev/null differ diff --git a/images/sheets/robot/body-male.png b/images/sheets/robot/body-male.png deleted file mode 100644 index bc258d9..0000000 Binary files a/images/sheets/robot/body-male.png and /dev/null differ diff --git a/index.html b/index.html index a6ffef7..717a53e 100644 --- a/index.html +++ b/index.html @@ -1,185 +1,174 @@ + - - - - - - + + + + + -
Loading...
- -
- - - - - - - - - - - +
+
Loading...
- +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- -
- -
- -
-
+
+
+ +
+ +
+ +
+
+ \ No newline at end of file diff --git a/jquery-1.8.2.min.js b/jquery-1.8.2.min.js deleted file mode 100644 index bc3fbc8..0000000 --- a/jquery-1.8.2.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v1.8.2 jquery.com | jquery.org/license */ -(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
t
",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;be.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="
",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="

",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
","
"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file diff --git a/main.mjs b/main.mjs new file mode 100644 index 0000000..6f4e3c1 --- /dev/null +++ b/main.mjs @@ -0,0 +1,6 @@ +import { CharacterGenerator } from './webchargen.mjs'; + +document.addEventListener('DOMContentLoaded', () => { + const generatorApp = new CharacterGenerator(); + generatorApp.init(); +}); diff --git a/painter.js b/painter.js deleted file mode 100644 index 24a94a5..0000000 --- a/painter.js +++ /dev/null @@ -1,325 +0,0 @@ -function Painter( canvas ) -{ - this.SPRITE_SIZE = 43; - this.PREVIEW_MULTI = 3; - - this.CANVAS = canvas; - - if ( window.G_vmlCanvasManager ) - window.G_vmlCanvasManager.initElement( canvas ); - - if ( canvas.getContext ) - this.CONTEXT = canvas.getContext( "2d" ); - - this.backArmCanvas = document.getElementById( "tempCanvas1" ); - this.backSleeveCanvas = document.getElementById( "tempCanvas2" ); - this.hairCanvas = document.getElementById( "tempCanvas3" ); - this.bodyCanvas = document.getElementById( "tempCanvas4" ); - this.pantsCanvas = document.getElementById( "tempCanvas5" ); - this.shirtCanvas = document.getElementById( "tempCanvas6" ); - this.helmetCanvas = document.getElementById( "tempCanvas7" ); - this.altCanvas = document.getElementById( "tempCanvas8" ); - this.headCanvas = document.getElementById( "tempCanvas9" ); - this.frontArmCanvas = document.getElementById( "tempCanvas10" ); - this.frontSleeveCanvas = document.getElementById( "tempCanvas11" ); -} - - -Painter.prototype.repaint = function( config, currentSettings, imageInfo ) -{ - console.log( "Painting sprite with " + Object.size( config ) + ", " + currentSettings.toString() ); - - // Clean up old gunk - this.CONTEXT.clearRect( 0, 0, this.SPRITE_SIZE * this.PREVIEW_MULTI, this.SPRITE_SIZE * this.PREVIEW_MULTI ); - - // For typing convenience! - var speciesVars = config.species[currentSettings.species].variables; - var armorVars = config.species[currentSettings.species].armors; - - // Determine the three sheets we need - body parts, shirt and pants - var bodySheet = imageInfo[currentSettings.species + "-body-" + currentSettings.gender]; - var accessorySheet = imageInfo[currentSettings.species + "-body-accessory"]; - var frontArmSheet = imageInfo[currentSettings.species + "-body-frontArm"]; - var backArmSheet = imageInfo[currentSettings.species + "-body-backArm"]; - - var shirtArmorSheet, pantsArmorSheet, frontSleeveSheet, backSleeveSheet, helmetArmorSheet, helmetMaskSheet; - var shirtArmorName = config.species[currentSettings.species].armors.names[currentSettings.shirtOption]; - var pantsArmorName = config.species[currentSettings.species].armors.names[currentSettings.pantsOption]; - - if ( shirtArmorName == "extra" ) - { - shirtArmorSheet = imageInfo["extra-" + currentSettings.gender + "Chest"]; - frontSleeveSheet= imageInfo["extra-frontSleeve"]; - backSleeveSheet = imageInfo["extra-backSleeve"]; - } - else - { - shirtArmorSheet = imageInfo[currentSettings.species + "-armor-" + shirtArmorName + "-" + currentSettings.gender + "Chest"]; - frontSleeveSheet= imageInfo[currentSettings.species + "-armor-" + shirtArmorName + "-frontSleeve"]; - backSleeveSheet = imageInfo[currentSettings.species + "-armor-" + shirtArmorName + "-backSleeve"]; - } - - if ( pantsArmorName == "extra" ) - pantsArmorSheet = imageInfo["extra-" + currentSettings.gender + "Pants"]; - else - pantsArmorSheet = imageInfo[currentSettings.species + "-armor-" + pantsArmorName + "-" + currentSettings.gender + "Pants"]; - - if ( config.extraArmorColor != null && currentSettings.helmetOption != currentSettings.helmetOptionMax ) - { - helmetArmorSheet = imageInfo["extra-helmet"]; - helmetMaskSheet = imageInfo["extra-mask"]; - } - //console.log( "Selecting sheets " + bodySheet.src + ", " + shirtArmorSheet.src + ", " + pantsArmorSheet.src ); - - // Which palette swaps should be used varies with species, set them up here - var bodyPalettes, hairPalette, shirtPalette, pantsPalette, helmetPalette; - - bodyPalettes = new Array( speciesVars.colors.skinColor[currentSettings.skinColor] ); - if ( speciesVars.altOptionAsUndyColor ) - bodyPalettes = bodyPalettes.concat( speciesVars.colors.undyColor[currentSettings.altOption] ); - if ( speciesVars.hairColorAsBodySubColor ) - bodyPalettes = bodyPalettes.concat( speciesVars.colors.hairColor[currentSettings.headOption] ); - - hairPalette = new Array(); - if ( speciesVars.headOptionAsHairColor ) - hairPalette = hairPalette.concat( speciesVars.colors.hairColor[currentSettings.headOption] ); - else - hairPalette = hairPalette.concat( bodyPalettes ); - - if ( speciesVars.altOptionAshairColor ) - hairPalette = hairPalette.concat( speciesVars.colors.undyColor[currentSettings.altOption] ); - - // Select the armor palettes to use, only one per - if ( armorVars.names[currentSettings.shirtOption] == "extra" ) - shirtPalette = new Array( config.extraArmorColor[currentSettings.shirtColor] ); - else if ( armorVars.names[currentSettings.shirtOption] != null ) - shirtPalette = new Array( armorVars.armorColors[currentSettings.shirtColor] ); - - if ( armorVars.names[currentSettings.pantsOption] == "extra" ) - pantsPalette = new Array( config.extraArmorColor[currentSettings.pantsColor] ); - else if ( armorVars.names[currentSettings.pantsOption] != null ) - pantsPalette = new Array( armorVars.armorColors[currentSettings.pantsColor] ); - - if ( helmetArmorSheet != null && currentSettings.helmetOption != currentSettings.helmetOptionMax ) - helmetPalette = new Array( config.extraArmorColor[currentSettings.helmetOption] ); - - // Offset certain sprites by gender - ie pants and shirt - var genderOffset = currentSettings.gender == "male" ? 0 : 1; - var hairOffset = speciesVars.genders[currentSettings.gender].hair.offsetY; - var headOffset = speciesVars.genders[currentSettings.gender].facialHair.offsetY; - var altOffset = speciesVars.genders[currentSettings.gender].facialMask.offsetY; - - // Pose config - var poseConfig = config.poses[currentSettings.poseOption]; - - // Paint erryting! - // Back Arm - this.paintToCanvas( backArmSheet, poseConfig.sleeveIndex[0], poseConfig.sleeveIndex[1], poseConfig.sleeveOffset[0], poseConfig.sleeveOffset[1], bodyPalettes, this.backArmCanvas ); - - // Back Sleeve Armor - if ( backSleeveSheet != null ) - this.paintToCanvas( backSleeveSheet, poseConfig.sleeveIndex[0], poseConfig.sleeveIndex[1], poseConfig.sleeveOffset[0], poseConfig.sleeveOffset[1], shirtPalette, this.backSleeveCanvas ); - else - this.backSleeveCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - - // Body - this.paintToCanvas( bodySheet, poseConfig.bodyIndex[0], poseConfig.bodyIndex[1], 0, 0, bodyPalettes, this.bodyCanvas ); - - // Pants Armor - if ( pantsArmorSheet != null ) - this.paintToCanvas( pantsArmorSheet, poseConfig.bodyIndex[0], poseConfig.bodyIndex[1], 0, 0, pantsPalette, this.pantsCanvas ); - else - this.pantsCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - - // Shirt Armor - if ( shirtArmorSheet != null ) - this.paintToCanvas( shirtArmorSheet, poseConfig.chestIndex[0], poseConfig.chestIndex[1], poseConfig.chestOffset[0], poseConfig.chestOffset[1], shirtPalette, this.shirtCanvas ); - else - this.shirtCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - - // Hair - if ( helmetArmorSheet == null || currentSettings.helmetOption == currentSettings.helmetOptionMax - 1 ) - this.paintToCanvas( accessorySheet, currentSettings.hairOption, hairOffset, poseConfig.hairOffset[0], poseConfig.hairOffset[1], hairPalette, this.hairCanvas ); - else - //this.hairCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - this.paintWithMask( accessorySheet, currentSettings.hairOption, hairOffset, poseConfig.hairOffset[0], poseConfig.hairOffset[1], hairPalette, this.hairCanvas, helmetMaskSheet ); - - // Head - if ( speciesVars.headOptionAsFacialHair ) - this.paintToCanvas( accessorySheet, currentSettings.headOption, headOffset, poseConfig.hairOffset[0], poseConfig.hairOffset[1], bodyPalettes, this.headCanvas ); - else - this.headCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - - // Alt - if ( speciesVars.altOptionAsFacialMask ) - this.paintToCanvas( accessorySheet, currentSettings.altOption, altOffset, poseConfig.hairOffset[0], poseConfig.hairOffset[1], bodyPalettes, this.altCanvas ); - else - this.altCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - - // Helmet - if ( helmetArmorSheet != null && currentSettings.helmetOption < currentSettings.helmetOptionMax - 1 ) - this.paintToCanvas( helmetArmorSheet, 1, 0, poseConfig.hairOffset[0], poseConfig.hairOffset[1], helmetPalette, this.helmetCanvas ); - - - // Front Arm - this.paintToCanvas( frontArmSheet, poseConfig.sleeveIndex[0], poseConfig.sleeveIndex[1], poseConfig.sleeveOffset[0], poseConfig.sleeveOffset[1], bodyPalettes, this.frontArmCanvas ); - - // Front Sleeve Armor - if ( frontSleeveSheet != null ) - this.paintToCanvas( frontSleeveSheet, poseConfig.sleeveIndex[0], poseConfig.sleeveIndex[1], poseConfig.sleeveOffset[0], poseConfig.sleeveOffset[1], shirtPalette, this.frontSleeveCanvas ); - else - this.frontSleeveCanvas.getContext( "2d" ).clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); -}; - - -Painter.prototype.paintToCanvas = function( sheet, offsetX, offsetY, nudgeX, nudgeY, paletteSwaps, tempCanvas ) -{ - //console.log( "Painting sprite at " + offsetX * this.SPRITE_SIZE + "," + offsetY * this.SPRITE_SIZE + " with " + paletteSwaps.length + " swaps, of sheet " + sheet.src ); - var tempCtx = tempCanvas.getContext( "2d" ); - - // Make sure to wrap too large offsetXs - while ( offsetX > 21 ) - { - offsetX -= 22; - offsetY++; - } - - // Clear out the temp canvas and splot our basic sheet onto it - tempCtx.clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - tempCtx.drawImage( sheet, -offsetX * this.SPRITE_SIZE, -offsetY * this.SPRITE_SIZE ); - - var imageData = tempCtx.getImageData( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ).data; - - // Go through each pixel in data - var px = this.SPRITE_SIZE * this.SPRITE_SIZE; - var posX = this.SPRITE_SIZE -1, posY = this.SPRITE_SIZE - 1; - - while ( px-- ) - { - //console.log( "Painting pixel " + px + " (" + posX + "," + posY + ")" ); - if ( imageData[4*px+3] != 0 ) - { - var colorHex = this.rgbToHex( imageData[4*px], imageData[4*px+1], imageData[4*px+2] ); - - //for ( var swap = 0; swap < paletteSwaps.length; swap++ ) - for ( swap in paletteSwaps ) - { - //console.log( paletteSwaps[swap] ); - for ( color in paletteSwaps[swap] ) - { - if ( color == colorHex ) - { - //for ( var swap2 = 0; swap2 < paletteSwaps[swap].length; swap2++ ) - //console.log( " Translating " + colorHex + " to " + paletteSwaps[swap][color] ); - colorHex = paletteSwaps[swap][color]; - } - } - } - - this.CONTEXT.fillStyle = "#" + colorHex; - this.CONTEXT.strokeStyle = "#" + colorHex; - tempCtx.fillStyle = "#" + colorHex; - tempCtx.strokeStyle = "#" + colorHex; - - //tempCtx.clearRect( posX, posY, 1, 1 ); - //tempCtx.fillRect( posX + nudgeX, posY + nudgeY, 1, 1 ); - - this.CONTEXT.fillRect( ( posX + nudgeX ) * this.PREVIEW_MULTI, ( posY + nudgeY ) * this.PREVIEW_MULTI, this.PREVIEW_MULTI, this.PREVIEW_MULTI ); - } - - posX--; - if ( posX < 0 ) - { - posX = this.SPRITE_SIZE - 1; - posY--; - } - } -}; - -Painter.prototype.paintWithMask = function( sheet, offsetX, offsetY, nudgeX, nudgeY, paletteSwaps, tempCanvas, mask ) -{ - console.log( "Painting sprite with mask at " + offsetX * this.SPRITE_SIZE + "," + offsetY * this.SPRITE_SIZE + " with " + paletteSwaps.length + " swaps, of sheet " + sheet.src ); - var tempCtx = tempCanvas.getContext( "2d" ); - - // Make sure to wrap too large offsetXs - while ( offsetX > 21 ) - { - offsetX -= 22; - offsetY++; - } - - // Clear out the temp canvas and splot our basic sheet onto it - tempCtx.clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - tempCtx.drawImage( mask, 0, 0 ); - - var maskData = tempCtx.getImageData( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ).data; - - // Clear out the temp canvas and splot our basic sheet onto it - tempCtx.clearRect( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ); - tempCtx.drawImage( sheet, -offsetX * this.SPRITE_SIZE, -offsetY * this.SPRITE_SIZE ); - - var imageData = tempCtx.getImageData( 0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE ).data; - - // Go through each pixel in data - var px = this.SPRITE_SIZE * this.SPRITE_SIZE; - var posX = this.SPRITE_SIZE -1, posY = this.SPRITE_SIZE - 1; - - while ( px-- ) - { - //console.log( "Painting pixel " + px + " (" + posX + "," + posY + ")" ); - if ( imageData[4*px+3] != 0 && maskData[4*px] == 255 ) - { - var colorHex = this.rgbToHex( imageData[4*px], imageData[4*px+1], imageData[4*px+2] ); - - //for ( var swap = 0; swap < paletteSwaps.length; swap++ ) - for ( swap in paletteSwaps ) - { - //console.log( paletteSwaps[swap] ); - for ( color in paletteSwaps[swap] ) - { - if ( color == colorHex ) - { - //for ( var swap2 = 0; swap2 < paletteSwaps[swap].length; swap2++ ) - //console.log( " Translating " + colorHex + " to " + paletteSwaps[swap][color] ); - colorHex = paletteSwaps[swap][color]; - } - } - } - - this.CONTEXT.fillStyle = "#" + colorHex; - this.CONTEXT.strokeStyle = "#" + colorHex; - tempCtx.fillStyle = "#" + colorHex; - tempCtx.strokeStyle = "#" + colorHex; - - //tempCtx.clearRect( posX, posY, 1, 1 ); - //tempCtx.fillRect( posX + nudgeX, posY + nudgeY, 1, 1 ); - - this.CONTEXT.fillRect( ( posX + nudgeX ) * this.PREVIEW_MULTI, ( posY + nudgeY ) * this.PREVIEW_MULTI, this.PREVIEW_MULTI, this.PREVIEW_MULTI ); - } - - posX--; - if ( posX < 0 ) - { - posX = this.SPRITE_SIZE - 1; - posY--; - } - } -}; - -Painter.prototype.rgbToHex = function( r, g, b ) -{ - var rs = r.toString(16); - if ( rs.length == 1 ) - rs = "0" + rs; - - var gs = g.toString(16); - if ( gs.length == 1 ) - gs = "0" + gs; - - var bs = b.toString(16); - if ( bs.length == 1 ) - bs = "0" + bs; - - - return rs + gs + bs; -}; \ No newline at end of file diff --git a/painter.mjs b/painter.mjs new file mode 100644 index 0000000..cffc186 --- /dev/null +++ b/painter.mjs @@ -0,0 +1,393 @@ +import { Settings } from './settings.mjs'; + +export class Painter { + constructor(canvas) { + this.SPRITE_SIZE = 43; + this.PREVIEW_MULTI = 3; + this.CANVAS = canvas; + + if (window.G_vmlCanvasManager) window.G_vmlCanvasManager.initElement(canvas); + + if (canvas.getContext) this.CONTEXT = canvas.getContext('2d'); + + this.tempCanvas = document.createElement('canvas'); + this.tempCanvas.width = this.SPRITE_SIZE; + this.tempCanvas.height = this.SPRITE_SIZE; + this.tempCanvas.style.display = 'none'; + } + + /** + * Repaints the canvas with the given configuration, settings, and image information. + * @param {Object} config - The configuration object. + * @param {Settings} currentSettings - The current settings object. + * @param {Object} imageInfo - The image information object. + */ + repaint(config, currentSettings, imageInfo) { + console.log(`Painting sprite with ${Object.keys(config).length}, ${currentSettings.toString()}`); + + // Clean up old gunk + this.CONTEXT.clearRect(0, 0, this.SPRITE_SIZE * this.PREVIEW_MULTI, this.SPRITE_SIZE * this.PREVIEW_MULTI); + + // For typing convenience! + const speciesVars = config.species[currentSettings.species].variables; + const armorVars = config.species[currentSettings.species].armors; + + // Determine the four sheets we need - head, body parts, shirt and pants + const headSheet = imageInfo[`${currentSettings.species}-head-${currentSettings.gender}`]; + const bodySheet = imageInfo[`${currentSettings.species}-body-${currentSettings.gender}`]; + const accessorySheet = imageInfo[`${currentSettings.species}-body-accessory`]; + const frontArmSheet = imageInfo[`${currentSettings.species}-body-frontArm`]; + const backArmSheet = imageInfo[`${currentSettings.species}-body-backArm`]; + + let shirtArmorSheet, pantsArmorSheet, frontSleeveSheet, backSleeveSheet, helmetArmorSheet, helmetMaskSheet; + const shirtArmorName = config.species[currentSettings.species].armors.names[currentSettings.shirtOption]; + const pantsArmorName = config.species[currentSettings.species].armors.names[currentSettings.pantsOption]; + + if (shirtArmorName === 'extra') { + shirtArmorSheet = imageInfo[`extra-${currentSettings.gender}Chest`]; + frontSleeveSheet = imageInfo['extra-frontSleeve']; + backSleeveSheet = imageInfo['extra-backSleeve']; + } else { + shirtArmorSheet = imageInfo[`${currentSettings.species}-armor-${shirtArmorName}-${currentSettings.gender}Chest`]; + frontSleeveSheet = imageInfo[`${currentSettings.species}-armor-${shirtArmorName}-frontSleeve`]; + backSleeveSheet = imageInfo[`${currentSettings.species}-armor-${shirtArmorName}-backSleeve`]; + } + + if (pantsArmorName === 'extra') pantsArmorSheet = imageInfo[`extra-${currentSettings.gender}Pants`]; + else pantsArmorSheet = imageInfo[`${currentSettings.species}-armor-${pantsArmorName}-${currentSettings.gender}Pants`]; + + if (config.extraArmorColor != null && currentSettings.helmetOption !== currentSettings.helmetOptionMax) { + helmetArmorSheet = imageInfo['extra-helmet']; + helmetMaskSheet = imageInfo['extra-mask']; + } + + // Which palette swaps should be used varies with species, set them up here + let bodyPalettes = [speciesVars.colors.skinColor[currentSettings.skinColor]]; + if (speciesVars.altOptionAsUndyColor) + bodyPalettes = bodyPalettes.concat(speciesVars.colors.undyColor[currentSettings.altOption]); + if (speciesVars.hairColorAsBodySubColor) + bodyPalettes = bodyPalettes.concat(speciesVars.colors.hairColor[currentSettings.headOption]); + + let hairPalette = []; + if (speciesVars.headOptionAsHairColor) + hairPalette = hairPalette.concat(speciesVars.colors.hairColor[currentSettings.headOption]); + else hairPalette = hairPalette.concat(bodyPalettes); + + if (speciesVars.altOptionAshairColor) + hairPalette = hairPalette.concat(speciesVars.colors.undyColor[currentSettings.altOption]); + + // Select the armor palettes to use, only one per + let shirtPalette = []; + if (armorVars.names[currentSettings.shirtOption] === 'extra') + shirtPalette = [config.extraArmorColor[currentSettings.shirtColor]]; + else if (armorVars.names[currentSettings.shirtOption] != null) + shirtPalette = [armorVars.armorColors[currentSettings.shirtColor]]; + + let pantsPalette = []; + if (armorVars.names[currentSettings.pantsOption] === 'extra') + pantsPalette = [config.extraArmorColor[currentSettings.pantsColor]]; + else if (armorVars.names[currentSettings.pantsOption] != null) + pantsPalette = [armorVars.armorColors[currentSettings.pantsColor]]; + + let helmetPalette = []; + if (helmetArmorSheet != null && currentSettings.helmetOption !== currentSettings.helmetOptionMax) + helmetPalette = [config.extraArmorColor[currentSettings.helmetOption]]; + + // Offset certain sprites by gender - ie pants and shirt + const genderOffset = currentSettings.gender === 'male' ? 0 : 1; + const hairOffset = speciesVars.genders[currentSettings.gender].hair.offsetY; + const headOffset = speciesVars.genders[currentSettings.gender].facialHair.offsetY; + const altOffset = speciesVars.genders[currentSettings.gender].facialMask.offsetY; + + // Pose config + const poseConfig = config.poses[currentSettings.poseOption]; + + // Paint erryting! + // Back Arm + this.paintToCanvas( + backArmSheet, + poseConfig.sleeveIndex[0], + poseConfig.sleeveIndex[1], + poseConfig.sleeveOffset[0], + poseConfig.sleeveOffset[1], + bodyPalettes + ); + + // Back Sleeve Armor + if (backSleeveSheet != null) + this.paintToCanvas( + backSleeveSheet, + poseConfig.sleeveIndex[0], + poseConfig.sleeveIndex[1], + poseConfig.sleeveOffset[0], + poseConfig.sleeveOffset[1], + shirtPalette + ); + + // Body + this.paintToCanvas( + bodySheet, + poseConfig.bodyIndex[0], + poseConfig.bodyIndex[1], + 0, + 0, + bodyPalettes + ); + + // Head + this.paintToCanvas( + headSheet, + 1, + 0, + poseConfig.hairOffset[0], + poseConfig.hairOffset[1], + bodyPalettes + ); + + // Pants Armor + if (pantsArmorSheet != null) + this.paintToCanvas( + pantsArmorSheet, + poseConfig.bodyIndex[0], + poseConfig.bodyIndex[1], + 0, + 0, + pantsPalette + ); + + // Shirt Armor + if (shirtArmorSheet != null) + this.paintToCanvas( + shirtArmorSheet, + poseConfig.chestIndex[0], + poseConfig.chestIndex[1], + poseConfig.chestOffset[0], + poseConfig.chestOffset[1], + shirtPalette + ); + + // Hair + if (helmetArmorSheet == null || currentSettings.helmetOption === currentSettings.helmetOptionMax - 1) + this.paintToCanvas( + accessorySheet, + currentSettings.hairOption, + hairOffset, + poseConfig.hairOffset[0], + poseConfig.hairOffset[1], + hairPalette + ); + else + this.paintWithMask( + accessorySheet, + currentSettings.hairOption, + hairOffset, + poseConfig.hairOffset[0], + poseConfig.hairOffset[1], + hairPalette, + helmetMaskSheet + ); + + // Head + if (speciesVars.headOptionAsFacialHair) + this.paintToCanvas( + accessorySheet, + currentSettings.headOption, + headOffset, + poseConfig.hairOffset[0], + poseConfig.hairOffset[1], + bodyPalettes + ); + + // Alt + if (speciesVars.altOptionAsFacialMask) + this.paintToCanvas( + accessorySheet, + currentSettings.altOption, + altOffset, + poseConfig.hairOffset[0], + poseConfig.hairOffset[1], + bodyPalettes + ); + + // Helmet + if (helmetArmorSheet != null && currentSettings.helmetOption < currentSettings.helmetOptionMax - 1) + this.paintToCanvas( + helmetArmorSheet, + 1, + 0, + poseConfig.hairOffset[0], + poseConfig.hairOffset[1], + helmetPalette + ); + + // Front Arm + this.paintToCanvas( + frontArmSheet, + poseConfig.sleeveIndex[0], + poseConfig.sleeveIndex[1], + poseConfig.sleeveOffset[0], + poseConfig.sleeveOffset[1], + bodyPalettes + ); + + // Front Sleeve Armor + if (frontSleeveSheet != null) + this.paintToCanvas( + frontSleeveSheet, + poseConfig.sleeveIndex[0], + poseConfig.sleeveIndex[1], + poseConfig.sleeveOffset[0], + poseConfig.sleeveOffset[1], + shirtPalette + ); + } + + /** + * Paints a sprite sheet onto the canvas with optional palette swaps. + * @param {HTMLImageElement} sheet - The sprite sheet image. + * @param {number} offsetX - The x offset in the sprite sheet. + * @param {number} offsetY - The y offset in the sprite sheet. + * @param {number} nudgeX - The x nudge for positioning. + * @param {number} nudgeY - The y nudge for positioning. + * @param {Array} [paletteSwaps=[]] - The palette swaps to apply. + */ + paintToCanvas(sheet, offsetX, offsetY, nudgeX, nudgeY, paletteSwaps = []) { + const tempCtx = this.tempCanvas.getContext('2d'); + + // Make sure to wrap too large offsetXs + while (offsetX > 21) { + offsetX -= 22; + offsetY++; + } + + // Clear out the temp canvas and splot our basic sheet onto it + tempCtx.clearRect(0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE); + tempCtx.drawImage(sheet, -offsetX * this.SPRITE_SIZE, -offsetY * this.SPRITE_SIZE); + + const imageData = tempCtx.getImageData(0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE).data; + + // Go through each pixel in data + let px = this.SPRITE_SIZE * this.SPRITE_SIZE; + let posX = this.SPRITE_SIZE - 1, + posY = this.SPRITE_SIZE - 1; + + while (px--) { + if (imageData[4 * px + 3] !== 0) { + let colorHex = this.rgbToHex(imageData[4 * px], imageData[4 * px + 1], imageData[4 * px + 2]); + + for (const swap of paletteSwaps) { + for (const color in swap) { + if (color === colorHex) { + colorHex = swap[color]; + } + } + } + + this.CONTEXT.fillStyle = `#${colorHex}`; + this.CONTEXT.strokeStyle = `#${colorHex}`; + + this.CONTEXT.fillRect( + (posX + nudgeX) * this.PREVIEW_MULTI, + (posY + nudgeY) * this.PREVIEW_MULTI, + this.PREVIEW_MULTI, + this.PREVIEW_MULTI + ); + } + + posX--; + if (posX < 0) { + posX = this.SPRITE_SIZE - 1; + posY--; + } + } + } + + /** + * Paints a sprite sheet onto the canvas with a mask and optional palette swaps. + * @param {HTMLImageElement} sheet - The sprite sheet image. + * @param {number} offsetX - The x offset in the sprite sheet. + * @param {number} offsetY - The y offset in the sprite sheet. + * @param {number} nudgeX - The x nudge for positioning. + * @param {number} nudgeY - The y nudge for positioning. + * @param {Array} [paletteSwaps=[]] - The palette swaps to apply. + * @param {HTMLImageElement} mask - The mask image. + */ + paintWithMask(sheet, offsetX, offsetY, nudgeX, nudgeY, paletteSwaps = [], mask) { + console.log( + `Painting sprite with mask at ${offsetX * this.SPRITE_SIZE},${offsetY * this.SPRITE_SIZE} with ${paletteSwaps.length} swaps, of sheet ${sheet.src}` + ); + const tempCtx = this.tempCanvas.getContext('2d'); + + // Make sure to wrap too large offsetXs + while (offsetX > 21) { + offsetX -= 22; + offsetY++; + } + + // Clear out the temp canvas and splot our basic sheet onto it + tempCtx.clearRect(0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE); + tempCtx.drawImage(mask, 0, 0); + + const maskData = tempCtx.getImageData(0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE).data; + + // Clear out the temp canvas and splot our basic sheet onto it + tempCtx.clearRect(0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE); + tempCtx.drawImage(sheet, -offsetX * this.SPRITE_SIZE, -offsetY * this.SPRITE_SIZE); + + const imageData = tempCtx.getImageData(0, 0, this.SPRITE_SIZE, this.SPRITE_SIZE).data; + + // Go through each pixel in data + let px = this.SPRITE_SIZE * this.SPRITE_SIZE; + let posX = this.SPRITE_SIZE - 1, + posY = this.SPRITE_SIZE - 1; + + while (px--) { + if (imageData[4 * px + 3] !== 0 && maskData[4 * px] === 255) { + let colorHex = this.rgbToHex(imageData[4 * px], imageData[4 * px + 1], imageData[4 * px + 2]); + for (const swap of paletteSwaps) { + for (const color in swap) { + if (color === colorHex) { + colorHex = swap[color]; + } + } + } + + this.CONTEXT.fillStyle = `#${colorHex}`; + this.CONTEXT.strokeStyle = `#${colorHex}`; + + this.CONTEXT.fillRect( + (posX + nudgeX) * this.PREVIEW_MULTI, + (posY + nudgeY) * this.PREVIEW_MULTI, + this.PREVIEW_MULTI, + this.PREVIEW_MULTI + ); + } + + posX--; + if (posX < 0) { + posX = this.SPRITE_SIZE - 1; + posY--; + } + } + } + + /** + * Converts RGB values to a hexadecimal color string. + * @param {number} r - The red component (0-255). + * @param {number} g - The green component (0-255). + * @param {number} b - The blue component (0-255). + * @returns {string} The hexadecimal color string. + */ + rgbToHex(r, g, b) { + let rs = r.toString(16); + if (rs.length === 1) rs = '0' + rs; + + let gs = g.toString(16); + if (gs.length === 1) gs = '0' + gs; + + let bs = b.toString(16); + if (bs.length === 1) bs = '0' + bs; + + return rs + gs + bs; + } +} diff --git a/settings.js b/settings.js deleted file mode 100644 index d09e79b..0000000 --- a/settings.js +++ /dev/null @@ -1,283 +0,0 @@ -/* - Juan big class to hold current option states. Makes sure to keep the customization options - sane during the darkest of nights. Keeps track of current choices, option max boundaries, - and updates counters to display the correct number. - */ - - -function Settings() -{ - this.species = "human"; - this.gender = "male"; - this.name; - - this.randomizeOptions = [ "skinColor", "altOption", "hairOption", "headOption", "shirtOption", "shirtColor", "pantsOption", "pantsColor", "helmetOption" ]; - - this.skinColor = 0; - this.altOption = 0; - this.hairOption = 0; - this.headOption = 0; - - this.shirtOption = 0; - this.shirtColor = 0; - this.pantsOption = 0; - this.pantsColor = 0; - this.helmetOption = 0; - - this.poseOption = 0; - - this.skinColorMax; - this.altOptionMax; - this.hairOptionMax; - this.headOptionMax; - - this.shirtOptionMax; - this.shirtColorMax; - this.pantsOptionMax; - this.pantsColorMax; - this.helmetOptionMax = 0; - - this.poseOptionMax; - - this.skinColorCounter = $("#variable-skinColor").children(".option-buttons").children(".option-counter").children(); - this.altOptionCounter = $("#variable-altOption").children(".option-buttons").children(".option-counter").children(); - this.hairOptionCounter = $("#variable-hairOption").children(".option-buttons").children(".option-counter").children(); - this.headOptionCounter = $("#variable-headOption").children(".option-buttons").children(".option-counter").children(); - this.shirtOptionCounter = $("#variable-shirtOption").children(".option-buttons").children(".option-counter").children(); - this.shirtColorCounter = $("#variable-shirtColor").children(".option-buttons").children(".option-counter").children(); - this.pantsOptionCounter = $("#variable-pantsOption").children(".option-buttons").children(".option-counter").children(); - this.pantsColorCounter = $("#variable-pantsColor").children(".option-buttons").children(".option-counter").children(); - this.helmetOptionCounter = $("#variable-helmetOption").children(".option-buttons").children(".option-counter").children(); - this.poseOptionCounter = $("#variable-poseOption").children(".option-buttons").children(".option-counter").children(); -}; - -Settings.prototype.updateCounters = function() -{ - // Skin color - var skinTemp = ( this.skinColor + 1 ) % 10; - this.skinColorCounter.eq(0).css( "backgroundPosition", -( this.skinColor - skinTemp + 1 ) + "px 0px" ); - this.skinColorCounter.eq(1).css( "backgroundPosition", -( skinTemp * 10 ) + "px 0px" ); - - // Alt option - var altTemp = ( this.altOption + 1 ) % 10; - this.altOptionCounter.eq(0).css( "backgroundPosition", -( this.altOption - altTemp + 1 ) + "px 0px" ); - this.altOptionCounter.eq(1).css( "backgroundPosition", -( altTemp * 10 ) + "px 0px" ); - - // Hair option - var hairTemp = ( this.hairOption + 1 ) % 10; - this.hairOptionCounter.eq(0).css( "backgroundPosition", -( this.hairOption - hairTemp + 1 ) + "px 0px" ); - this.hairOptionCounter.eq(1).css( "backgroundPosition", -( hairTemp * 10 ) + "px 0px" ); - - // Head option - var headTemp = ( this.headOption + 1 ) % 10; - this.headOptionCounter.eq(0).css( "backgroundPosition", -( this.headOption - headTemp + 1 ) + "px 0px" ); - this.headOptionCounter.eq(1).css( "backgroundPosition", -( headTemp * 10 ) + "px 0px" ); - - // Shirt option - var shirtTemp = ( this.shirtOption + 1 ) % 10; - this.shirtOptionCounter.eq(0).css( "backgroundPosition", -( this.shirtOption - shirtTemp + 1 ) + "px 0px" ); - this.shirtOptionCounter.eq(1).css( "backgroundPosition", -( shirtTemp * 10 ) + "px 0px" ); - - // Shirt color - var shirtColorTemp = ( this.shirtColor + 1 ) % 10; - this.shirtColorCounter.eq(0).css( "backgroundPosition", -( this.shirtColor - shirtColorTemp + 1 ) + "px 0px" ); - this.shirtColorCounter.eq(1).css( "backgroundPosition", -( shirtColorTemp * 10 ) + "px 0px" ); - - // Pants option - var pantsTemp = ( this.pantsOption + 1 ) % 10; - this.pantsOptionCounter.eq(0).css( "backgroundPosition", -( this.pantsOption - pantsTemp + 1 ) + "px 0px" ); - this.pantsOptionCounter.eq(1).css( "backgroundPosition", -( pantsTemp * 10 ) + "px 0px" ); - - // Pants color - var pantsColorTemp = ( this.pantsColor + 1 ) % 10; - this.pantsColorCounter.eq(0).css( "backgroundPosition", -( this.pantsColor - pantsColorTemp + 1 ) + "px 0px" ); - this.pantsColorCounter.eq(1).css( "backgroundPosition", -( pantsColorTemp * 10 ) + "px 0px" ); - - // Pose option - var poseTemp = ( this.poseOption + 1 ) % 10; - this.poseOptionCounter.eq(0).css( "backgroundPosition", -( this.poseOption - poseTemp + 1 ) + "px 0px" ); - this.poseOptionCounter.eq(1).css( "backgroundPosition", -( poseTemp * 10 ) + "px 0px" ); - - // Helmet option - var helmetTemp = ( this.helmetOption + 1 ) % 10; - this.helmetOptionCounter.eq(0).css( "backgroundPosition", -( this.helmetOption - helmetTemp + 1 ) + "px 0px" ); - this.helmetOptionCounter.eq(1).css( "backgroundPosition", -( helmetTemp * 10 ) + "px 0px" ); -}; - -Settings.prototype.reset = function( species ) -{ - // Reset as few options as we have to, to preserve state - if ( species ) - { - this.skinColor = 0; - this.altOption = 0; - this.hairOption = 0; - this.headOption = 0; - } - - // Remaining options will be capped by recalc -}; - -Settings.prototype.recalc = function( config ) -{ - var vars = config.species[this.species].variables; - var armors = config.species[this.species].armors; - - // Skin color - this.skinColorMax = vars.colors.skinColor.length; - if ( this.skinColor >= this.skinColorMax ) - this.skinColor = this.skinColorMax -1; - - // Alt option - if ( vars.altOptionAsUndyColor ) - this.altOptionMax = vars.colors.undyColor.length; - else if ( vars.altOptionAsFacialMask ) - this.altOptionMax = vars.genders[this.gender].facialMask.count; - else - this.altOptionMax = 0; - if ( this.altOption >= this.altOptionMax ) - this.altOption = this.altOptionMax -1; - - // Hair option - this.hairOptionMax = vars.genders[this.gender].hair.count; - if ( this.hairOption >= this.hairOptionMax ) - this.hairOption = this.hairOptionMax -1; - - // Head option - if ( vars.headOptionAsHairColor ) - this.headOptionMax = vars.colors.hairColor.length; - else if ( vars.headOptionAsFacialHair === true ) - this.headOptionMax = vars.genders[this.gender].facialHair.count; - else - this.headOptionMax = 0; - if ( this.headOption >= this.headOptionMax ) - this.headOption = this.headOptionMax -1; - - // Shirt option(al) - this.shirtOptionMax = armors.names.length; - if ( this.shirtOption >= this.shirtOptionMax ) - this.shirtOption = this.shirtOptionMax -1; - - // Pants (also) option(al) - this.pantsOptionMax = armors.names.length; - if ( this.pantsOption >= this.pantsOptionMax ) - this.pantsOption = this.pantsOptionMax -1; - - // Shirt colour - this.shirtColorMax = armors.armorColors.length; - if ( this.shirtColor >= this.shirtColorMax ) - this.shirtColor = this.shirtColorMax -1; - - // Chest colour - this.pantsColorMax = armors.armorColors.length; - if ( this.pantsColor >= this.pantsColorMax ) - this.pantsColor = this.pantsColorMax -1; - - // Poses - this.poseOptionMax = config.poses.length; - if ( this.poseOption >= this.poseOptionMax ) - this.poseOption = this.poseOptionMax -1; - - // Helmet - if ( armors.names[armors.names.length-1] !== null ) - { - this.helmetOptionMax = config.extraArmorColor.length + 1; - if ( this.helmetOption >= this.helmetOptionMax ) - this.helmetOption = config.extraArmorColor.length; - } -}; - -Settings.prototype.randomize = function() -{ - console.log( "Randomizing options" ); - for ( var opt in this.randomizeOptions ) - { - var optName = this.randomizeOptions[opt]; - console.log( "Randomizing option " + optName ); - this[optName] = Math.floor( Math.random() * this[optName + "Max"] ); - } - - // Pose is a special case, and should have some weighting applied - var poseWeight = 50; - var poseRandom = Math.floor( Math.random() * poseWeight ); - if ( poseRandom > poseWeight - this.poseOptionMax ) - { - poseRandom = poseRandom - poseWeight + this.poseOptionMax; - this.poseOption = poseRandom; - } - else - { - poseRandom = poseRandom % 5; - this.poseOption = poseRandom; - } - - // Helmet also deserves a special treatment - if ( this.helmetOptionMax > 0 && Math.random() < 0.8 ) - this.helmetOption = this.helmetOptionMax - 1; -}; - - -Settings.prototype.setName = function( name ) -{ - if ( this.name === name ) - return; - - this.name = name; - - $.getJSON( "images/sheets/" + toHash( name ) + "/data.json", function ( data ) { currentSettings.checkName( data ); } ); -}; - -Settings.prototype.toString = function() -{ - return "Settings[species=" + this.species + ", gender=" + this.gender + ", skinColor=" + this.skinColor + - ", altOption=" + this.altOption + ", headOption=" + this.headOption + ", hairOption=" + - this.hairOption + ", shirtOption=" + this.shirtOption + ", shirtColor=" + this.shirtColor + - ", pantsOption=" + this.pantsOption + ", pantsColor=" + this.pantsColor + - ", poseOption=" + this.poseOption + ", helmetOption=" + this.helmetOption + - ", skinColorMax=" + this.skinColorMax + ", altOptionMax=" + this.altOptionMax + - ", hairOptionMax=" + this.hairOptionMax + ", headOptionMax=" + this.headOptionMax + - ", shirtOptionMax=" + this.shirtOptionMax + ", shirtColorMax=" + this.shirtColorMax + - ", pantsOptionMax=" + this.pantsOptionMax + ", pantsColorMax=" + this.pantsColorMax + - ", poseOptionMax=" + this.poseOptionMax + ", helmetOptionMax=" + this.helmetOptionMax + "]"; -}; - -Settings.prototype.checkName = function( data ) -{ - if ( data == null || data.armorColor == null ) - return; - - console.log( "Checked " + toHash( currentSettings.name ) + " with return " + data ); - - for ( var r in config.species ) - { - var armors = config.species[r].armors - if ( armors.names[armors.names.length-1] !== "extra" ) - { - armors.names[armors.names.length] = "extra"; - } - } - - config.extraArmorColor = data.armorColor; - config.extraHelmet = data.helmet; - - for ( var n in data.names ) - { - var name = data.names[n]; - console.log( "Loading extra sheet " + name ); - var img = new Image(); - img.src = "images/sheets/" + toHash( this.name ) + "/" + name + ".png"; - img.onload = function() { painter.repaint( config, currentSettings, imageInfo ); }; - imageInfo["extra-" + name] = img; - } - - this.recalc( config ); - this.shirtOption = this.shirtOptionMax - 1; - this.shirtColorOption = 0; - this.pantsOption = this.pantsOptionMax - 1; - this.pantsColorOption = 0; - this.helmetOption = 0; - - this.updateCounters(); - $("#variable-helmetOption").css( "display", "inline-block" ); -} - diff --git a/settings.mjs b/settings.mjs new file mode 100644 index 0000000..60daeed --- /dev/null +++ b/settings.mjs @@ -0,0 +1,373 @@ +/* + Juan big class to hold current option states. Makes sure to keep the customization options + sane during the darkest of nights. Keeps track of current choices, option max boundaries, + and updates counters to display the correct number. + */ + +export class Settings { + /** + * @property {string} species - The species of the character. + * @property {string} gender - The gender of the character. + * @property {string} name - The name of the character. + * @property {Array} randomizeOptions - The options that can be randomized. + * @property {number} skinColor - The skin color index. + * @property {number} altOption - The alternate option index. + * @property {number} hairOption - The hair option index. + * @property {number} headOption - The head option index. + * @property {number} shirtOption - The shirt option index. + * @property {number} shirtColor - The shirt color index. + * @property {number} pantsOption - The pants option index. + * @property {number} pantsColor - The pants color index. + * @property {number} helmetOption - The helmet option index. + * @property {number} poseOption - The pose option index. + * @property {number} skinColorMax - The maximum skin color index. + * @property {number} altOptionMax - The maximum alternate option index. + * @property {number} hairOptionMax - The maximum hair option index. + * @property {number} headOptionMax - The maximum head option index. + * @property {number} shirtOptionMax - The maximum shirt option index. + * @property {number} shirtColorMax - The maximum shirt color index. + * @property {number} pantsOptionMax - The maximum pants option index. + * @property {number} pantsColorMax - The maximum pants color index. + * @property {number} helmetOptionMax - The maximum helmet option index. + * @property {number} poseOptionMax - The maximum pose option index. + * @property {NodeListOf} skinColorCounter - The skin color counter elements. + * @property {NodeListOf} altOptionCounter - The alternate option counter elements. + * @property {NodeListOf} hairOptionCounter - The hair option counter elements. + * @property {NodeListOf} headOptionCounter - The head option counter elements. + * @property {NodeListOf} shirtOptionCounter - The shirt option counter elements. + * @property {NodeListOf} shirtColorCounter - The shirt color counter elements. + * @property {NodeListOf} pantsOptionCounter - The pants option counter elements. + * @property {NodeListOf} pantsColorCounter - The pants color counter elements. + * @property {NodeListOf} helmetOptionCounter - The helmet option counter elements. + * @property {NodeListOf} poseOptionCounter - The pose option counter elements. + */ + constructor() { + this.species = 'human'; + this.gender = 'male'; + this.name; + + this.randomizeOptions = [ + 'skinColor', + 'altOption', + 'hairOption', + 'headOption', + 'shirtOption', + 'shirtColor', + 'pantsOption', + 'pantsColor', + 'helmetOption', + ]; + + this.skinColor = 0; + this.altOption = 0; + this.hairOption = 0; + this.headOption = 0; + + this.shirtOption = 0; + this.shirtColor = 0; + this.pantsOption = 0; + this.pantsColor = 0; + this.helmetOption = 0; + + this.poseOption = 0; + + this.skinColorMax; + this.altOptionMax; + this.hairOptionMax; + this.headOptionMax; + + this.shirtOptionMax; + this.shirtColorMax; + this.pantsOptionMax; + this.pantsColorMax; + this.helmetOptionMax = 0; + + this.poseOptionMax; + + this.skinColorCounter = document.querySelectorAll('#variable-skinColor .option-buttons .option-counter > *'); + this.altOptionCounter = document.querySelectorAll('#variable-altOption .option-buttons .option-counter > *'); + this.hairOptionCounter = document.querySelectorAll('#variable-hairOption .option-buttons .option-counter > *'); + this.headOptionCounter = document.querySelectorAll('#variable-headOption .option-buttons .option-counter > *'); + this.shirtOptionCounter = document.querySelectorAll('#variable-shirtOption .option-buttons .option-counter > *'); + this.shirtColorCounter = document.querySelectorAll('#variable-shirtColor .option-buttons .option-counter > *'); + this.pantsOptionCounter = document.querySelectorAll('#variable-pantsOption .option-buttons .option-counter > *'); + this.pantsColorCounter = document.querySelectorAll('#variable-pantsColor .option-buttons .option-counter > *'); + this.helmetOptionCounter = document.querySelectorAll('#variable-helmetOption .option-buttons .option-counter > *'); + this.poseOptionCounter = document.querySelectorAll('#variable-poseOption .option-buttons .option-counter > *'); + } + + /** + * Updates the counters for the current settings. + */ + updateCounters() { + // Skin color + let skinTemp = (this.skinColor + 1) % 10; + this.skinColorCounter[0].style.backgroundPosition = `-${this.skinColor - skinTemp + 1}px 0px`; + this.skinColorCounter[1].style.backgroundPosition = `-${skinTemp * 10}px 0px`; + + // Alt option + let altTemp = (this.altOption + 1) % 10; + this.altOptionCounter[0].style.backgroundPosition = `-${this.altOption - altTemp + 1}px 0px`; + this.altOptionCounter[1].style.backgroundPosition = `-${altTemp * 10}px 0px`; + + // Hair option + let hairTemp = (this.hairOption + 1) % 10; + this.hairOptionCounter[0].style.backgroundPosition = `-${this.hairOption - hairTemp + 1}px 0px`; + this.hairOptionCounter[1].style.backgroundPosition = `-${hairTemp * 10}px 0px`; + + // Head option + let headTemp = (this.headOption + 1) % 10; + this.headOptionCounter[0].style.backgroundPosition = `-${this.headOption - headTemp + 1}px 0px`; + this.headOptionCounter[1].style.backgroundPosition = `-${headTemp * 10}px 0px`; + + // Shirt option + let shirtTemp = (this.shirtOption + 1) % 10; + this.shirtOptionCounter[0].style.backgroundPosition = `-${this.shirtOption - shirtTemp + 1}px 0px`; + this.shirtOptionCounter[1].style.backgroundPosition = `-${shirtTemp * 10}px 0px`; + + // Shirt color + let shirtColorTemp = (this.shirtColor + 1) % 10; + this.shirtColorCounter[0].style.backgroundPosition = `-${this.shirtColor - shirtColorTemp + 1}px 0px`; + this.shirtColorCounter[1].style.backgroundPosition = `-${shirtColorTemp * 10}px 0px`; + + // Pants option + let pantsTemp = (this.pantsOption + 1) % 10; + this.pantsOptionCounter[0].style.backgroundPosition = `-${this.pantsOption - pantsTemp + 1}px 0px`; + this.pantsOptionCounter[1].style.backgroundPosition = `-${pantsTemp * 10}px 0px`; + + // Pants color + let pantsColorTemp = (this.pantsColor + 1) % 10; + this.pantsColorCounter[0].style.backgroundPosition = `-${this.pantsColor - pantsColorTemp + 1}px 0px`; + this.pantsColorCounter[1].style.backgroundPosition = `-${pantsColorTemp * 10}px 0px`; + + // Pose option + let poseTemp = (this.poseOption + 1) % 10; + this.poseOptionCounter[0].style.backgroundPosition = `-${this.poseOption - poseTemp + 1}px 0px`; + this.poseOptionCounter[1].style.backgroundPosition = `-${poseTemp * 10}px 0px`; + + // Helmet option + let helmetTemp = (this.helmetOption + 1) % 10; + this.helmetOptionCounter[0].style.backgroundPosition = `-${this.helmetOption - helmetTemp + 1}px 0px`; + this.helmetOptionCounter[1].style.backgroundPosition = `-${helmetTemp * 10}px 0px`; + } + + /** + * Resets the settings. + * @param {boolean} species - Whether to reset species-related options. + */ + reset(species) { + // Reset as few options as we have to, to preserve state + if (species) { + this.skinColor = 0; + this.altOption = 0; + this.hairOption = 0; + this.headOption = 0; + } + + // Remaining options will be capped by recalc + } + + /** + * Recalculates the maximum values for the settings based on the configuration. + * @param {Object} config - The configuration object. + */ + recalc(config) { + let vars = config.species[this.species].variables; + let armors = config.species[this.species].armors; + + // Skin color + this.skinColorMax = vars.colors.skinColor.length; + if (this.skinColor >= this.skinColorMax) this.skinColor = this.skinColorMax - 1; + + // Alt option + if (vars.altOptionAsUndyColor) this.altOptionMax = vars.colors.undyColor.length; + else if (vars.altOptionAsFacialMask) this.altOptionMax = vars.genders[this.gender].facialMask.count; + else this.altOptionMax = 0; + if (this.altOption >= this.altOptionMax) this.altOption = this.altOptionMax - 1; + + // Hair option + this.hairOptionMax = vars.genders[this.gender].hair.count; + if (this.hairOption >= this.hairOptionMax) this.hairOption = this.hairOptionMax - 1; + + // Head option + if (vars.headOptionAsHairColor) this.headOptionMax = vars.colors.hairColor.length; + else if (vars.headOptionAsFacialHair === true) this.headOptionMax = vars.genders[this.gender].facialHair.count; + else this.headOptionMax = 0; + if (this.headOption >= this.headOptionMax) this.headOption = this.headOptionMax - 1; + + // Shirt option(al) + this.shirtOptionMax = armors.names.length; + if (this.shirtOption >= this.shirtOptionMax) this.shirtOption = this.shirtOptionMax - 1; + + // Pants (also) option(al) + this.pantsOptionMax = armors.names.length; + if (this.pantsOption >= this.pantsOptionMax) this.pantsOption = this.pantsOptionMax - 1; + + // Shirt colour + this.shirtColorMax = armors.armorColors.length; + if (this.shirtColor >= this.shirtColorMax) this.shirtColor = this.shirtColorMax - 1; + + // Chest colour + this.pantsColorMax = armors.armorColors.length; + if (this.pantsColor >= this.pantsColorMax) this.pantsColor = this.pantsColorMax - 1; + + // Poses + this.poseOptionMax = config.poses.length; + if (this.poseOption >= this.poseOptionMax) this.poseOption = this.poseOptionMax - 1; + + // Helmet + if (armors.names[armors.names.length - 1] !== null) { + this.helmetOptionMax = config.extraArmorColor.length + 1; + if (this.helmetOption >= this.helmetOptionMax) this.helmetOption = config.extraArmorColor.length; + } + } + + /** + * Randomizes the settings. + */ + randomize() { + console.log('Randomizing options'); + for (let optName of this.randomizeOptions) { + console.log('Randomizing option ' + optName); + this[optName] = Math.floor(Math.random() * this[optName + 'Max']); + } + + // Pose is a special case, and should have some weighting applied + let poseWeight = 50; + let poseRandom = Math.floor(Math.random() * poseWeight); + if (poseRandom > poseWeight - this.poseOptionMax) { + poseRandom = poseRandom - poseWeight + this.poseOptionMax; + this.poseOption = poseRandom; + } else { + poseRandom = poseRandom % 5; + this.poseOption = poseRandom; + } + + // Helmet also deserves a special treatment + if (this.helmetOptionMax > 0 && Math.random() < 0.8) this.helmetOption = this.helmetOptionMax - 1; + } + + /** + * Sets the name of the character. + * @param {string} name - The name to set. + */ + setName(name) { + if (this.name === name) return; + + this.name = name; + + fetch(`images/sheets/${toHash(name)}/data.json`) + .then((response) => response.json()) + .then((data) => currentSettings.checkName(data)); + } + + /** + * Converts the settings to a string representation. + * @returns {string} The string representation of the settings. + */ + toString() { + return ( + 'Settings[species=' + + this.species + + ', gender=' + + this.gender + + ', skinColor=' + + this.skinColor + + ', altOption=' + + this.altOption + + ', headOption=' + + this.headOption + + ', hairOption=' + + this.hairOption + + ', shirtOption=' + + this.shirtOption + + ', shirtColor=' + + this.shirtColor + + ', pantsOption=' + + this.pantsOption + + ', pantsColor=' + + this.pantsColor + + ', poseOption=' + + this.poseOption + + ', helmetOption=' + + this.helmetOption + + ', skinColorMax=' + + this.skinColorMax + + ', altOptionMax=' + + this.altOptionMax + + ', hairOptionMax=' + + this.hairOptionMax + + ', headOptionMax=' + + this.headOptionMax + + ', shirtOptionMax=' + + this.shirtOptionMax + + ', shirtColorMax=' + + this.shirtColorMax + + ', pantsOptionMax=' + + this.pantsOptionMax + + ', pantsColorMax=' + + this.pantsColorMax + + ', poseOptionMax=' + + this.poseOptionMax + + ', helmetOptionMax=' + + this.helmetOptionMax + + ']' + ); + } + + /** + * Checks the name of the character against the provided data. + * @param {Object} data - The data to check against. + */ + checkName(data) { + if (!data || !data.armorColor) return; + + console.log('Checked ' + toHash(currentSettings.name) + ' with return ' + data); + + for (let r in config.species) { + let armors = config.species[r].armors; + if (armors.names[armors.names.length - 1] !== null) { + armors.names[armors.names.length] = 'extra'; + } + } + + config.extraArmorColor = data.armorColor; + config.extraHelmet = data.helmet; + + for (let name of data.names) { + console.log('Loading extra sheet ' + name); + let img = new Image(); + img.src = 'images/sheets/' + toHash(this.name) + '/' + name + '.png'; + img.onload = function () { + painter.repaint(config, currentSettings, imageInfo); + }; + imageInfo['extra-' + name] = img; + } + + this.recalc(config); + this.shirtOption = this.shirtOptionMax - 1; + this.shirtColorOption = 0; + this.pantsOption = this.pantsOptionMax - 1; + this.pantsColorOption = 0; + this.helmetOption = 0; + + this.updateCounters(); + document.querySelector('#variable-helmetOption').style.display = 'inline-block'; + } +} + +/** + * Converts a string to a hash. + * @param {string} string - The string to hash. + * @returns {string} The hash of the string. + */ +function toHash(string) { + let hash = 17; + + for (let i = 0; i < string.length; i++) { + hash = (hash << 5) - hash + string.charCodeAt(i); + hash = hash & hash; + } + + return hash.toString(16); +} diff --git a/webchargen.config.json b/webchargen.config.json index 14b03ca..a5f44e8 100644 --- a/webchargen.config.json +++ b/webchargen.config.json @@ -1,1018 +1,1137 @@ { - "species" : { - "human" : { - "variables" : { - "altOptionAsUndyColor" : true, - "altOptionAsFacialMask" : false, - "headOptionAsHairColor" : true, - "headOptionAsFacialHair" : false, - "names" : [ "skinColor", "undyColor", "hairStyle", "hairColor" ], - "genders" : { - "iconOffset" : 0, - "male" : { - "hair" : { - "offsetY" : 1, - "count" : 61 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY": -1, - "count" : -1 - } - }, - "female" : { - "hair" : { - "offsetY" : 4, - "count" : 55 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY": -1, - "count" : -1 - } - } - }, - "colors" : { - "skinColor" : [ - { "ffe2c5" : "ffe9d3", "ffc181" : "ffc181", "d39c6c" : "d39c6c", "c7815b" : "b97551" }, - { "ffe2c5" : "fff6f6", "ffc181" : "f7d5d3", "d39c6c" : "d1aaa1", "c7815b" : "a27f70" }, - { "ffe2c5" : "fff7ec", "ffc181" : "f9d3a9", "d39c6c" : "d3a57c", "c7815b" : "b37c5d" }, - { "ffe2c5" : "fbe1d4", "ffc181" : "f6baa2", "d39c6c" : "cc9582", "c7815b" : "ac7261" }, - { "ffe2c5" : "f4e0ba", "ffc181" : "e9b768", "d39c6c" : "c18f54", "c7815b" : "a2683d" }, - { "ffe2c5" : "e8cebc", "ffc181" : "cfa97d", "d39c6c" : "ae774b", "c7815b" : "804e34" }, - { "ffe2c5" : "e1b98d", "ffc181" : "c88959", "d39c6c" : "9e6a4d", "c7815b" : "784930" }, - { "ffe2c5" : "c9b181", "ffc181" : "ac8348", "d39c6c" : "87633f", "c7815b" : "694c31" }, - { "ffe2c5" : "c5ad98", "ffc181" : "a47a59", "d39c6c" : "865d40", "c7815b" : "66412e" }, - { "ffe2c5" : "ab8c77", "ffc181" : "86644a", "d39c6c" : "684431", "c7815b" : "40271d" } - ], - "undyColor" : [ - { "dc1f00" : "4d76ad", "be1b00" : "395187", "951500" : "20325b" }, - { "dc1f00" : "7c41b8", "be1b00" : "6c2f90", "951500" : "471962" }, - { "dc1f00" : "c63442", "be1b00" : "9b2724", "951500" : "6a1210" }, - { "dc1f00" : "eaa245", "be1b00" : "b47020", "951500" : "834a0c" }, - { "dc1f00" : "e3e13a", "be1b00" : "a8a614", "951500" : "848008" }, - { "dc1f00" : "6ab841", "be1b00" : "45902f", "951500" : "296219" }, - { "dc1f00" : "535353", "be1b00" : "363636", "951500" : "111111" }, - { "dc1f00" : "e6e6e6", "be1b00" : "979797", "951500" : "6f6f6f" }, - { "dc1f00" : "9e9e9e", "be1b00" : "6e6e6e", "951500" : "434343" }, - { "dc1f00" : "f794f8", "be1b00" : "d355c1", "951500" : "b72c95" } - ], - "hairColor" : [ - { "d9c189" : "525252", "a38d59" : "363636", "735e3a" : "161616" }, - { "d9c189" : "50422f", "a38d59" : "36261e", "735e3a" : "170f0d" }, - { "d9c189" : "7f5a39", "a38d59" : "5b3523", "735e3a" : "3b1f15" }, - { "d9c189" : "a6671d", "a38d59" : "915622", "735e3a" : "743e1d" }, - { "d9c189" : "e6e756", "a38d59" : "c7ac3f", "735e3a" : "a9882f" }, - { "d9c189" : "f2eba3", "a38d59" : "dcd28c", "735e3a" : "c2b677" }, - { "d9c189" : "7d3c1c", "a38d59" : "4d240b", "735e3a" : "2d1606" }, - { "d9c189" : "ad2716", "a38d59" : "8f1f1b", "735e3a" : "731a1a" }, - { "d9c189" : "b8b8b8", "a38d59" : "828282", "735e3a" : "555555" }, - { "d9c189" : "eaeaea", "a38d59" : "b8b8b8", "735e3a" : "828282" }, - { "d9c189" : "6f6d85", "a38d59" : "525269", "735e3a" : "3e4352" }, - { "d9c189" : "cd72d9", "a38d59" : "ac4da6", "735e3a" : "913b86" }, - { "d9c189" : "425879", "a38d59" : "343965", "735e3a" : "242247" }, - { "d9c189" : "5d8bc7", "a38d59" : "4d55b0", "735e3a" : "2e2a73" }, - { "d9c189" : "653b7f", "a38d59" : "562e6a", "735e3a" : "3f1d4b" }, - { "d9c189" : "7f3b6d", "a38d59" : "6a2e53", "735e3a" : "4b1d30" }, - { "d9c189" : "efa838", "a38d59" : "be6d1d", "735e3a" : "834012" }, - { "d9c189" : "4ece61", "a38d59" : "34ae47", "735e3a" : "228a38" }, - { "d9c189" : "3b7f44", "a38d59" : "2e6a38", "735e3a" : "1d4b28" }, - { "d9c189" : "74726f", "a38d59" : "53504d", "735e3a" : "2a251e" } - ] - } - }, - "armors" : { - "names" : ["concept","cool","sweatervest","workout", null], - "armorColors" : [ - { "ffca8a" : "809ebe", "e0975c" : "485971", "a85636" : "273040", "6f2919" : "11151e" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - }, - "avian" : { - "variables" : { - "altOptionAsUndyColor" : false, - "altOptionAsFacialMask" : true, - "headOptionAsHairColor" : false, - "headOptionAsFacialHair" : true, - "names" : [ "featherColor", "beakStyle", "plumage", "fluff" ], - "genders" : { - "iconOffset" : 0, - "male" : { - "hair" : { - "offsetY" : 3, - "count" : 24 - }, - "facialMask" : { - "offsetY" : 1, - "count" : 10 - }, - "facialHair" : { - "offsetY" : 2, - "count" : 10 - } - }, - "female" : { - "hair" : { - "offsetY" : 3, - "count" : 24 - }, - "facialMask" : { - "offsetY" : 1, - "count" : 10 - }, - "facialHair" : { - "offsetY" : 2, - "count" : 10 - } - } - }, - "colors" : { - "skinColor" : [ - { "ffca8a" : "f0608b", "e0975c" : "cd5061", "a85636" : "95484c", "6f2919" : "6a3836", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eacf60", "a38d59" : "c1a24e", "735e3a" : "977841" }, - { "ffca8a" : "7fdadd", "e0975c" : "61aebf", "a85636" : "4e7a90", "6f2919" : "3f566e", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eacf60", "a38d59" : "c1a24e", "735e3a" : "977841" }, - { "ffca8a" : "add068", "e0975c" : "85ac1b", "a85636" : "6e8210", "6f2919" : "596809", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eacf60", "a38d59" : "c1a24e", "735e3a" : "977841" }, - { "ffca8a" : "f3efa3", "e0975c" : "e3d965", "a85636" : "baa94a", "6f2919" : "98832d", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "efad56", "a38d59" : "c5813e", "735e3a" : "9b6638" }, - { "ffca8a" : "998779", "e0975c" : "836752", "a85636" : "625244", "6f2919" : "4e3b2e", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "efad56", "a38d59" : "c5813e", "735e3a" : "9b6638" }, - { "ffca8a" : "737275", "e0975c" : "595760", "a85636" : "3f3e43", "6f2919" : "212123", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eacf60", "a38d59" : "c1a24e", "735e3a" : "977841" }, - { "ffca8a" : "eebfea", "e0975c" : "de8ddd", "a85636" : "c060bb", "6f2919" : "9a4b9c", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eae660", "a38d59" : "c1b54e", "735e3a" : "978841" }, - { "ffca8a" : "d18bd5", "e0975c" : "a766bc", "a85636" : "814797", "6f2919" : "693367", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "efad56", "a38d59" : "c5813e", "735e3a" : "9b6638" }, - { "ffca8a" : "f3c873", "e0975c" : "db9c38", "a85636" : "b17628", "6f2919" : "89561f", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eae660", "a38d59" : "c1b54e", "735e3a" : "978841" }, - { "ffca8a" : "deeded", "e0975c" : "c5d8d8", "a85636" : "96aba9", "6f2919" : "6f807e", "f32200" : "f6fbfb", "dc1f00" : "d7e8e8", "be1b00" : "8fa7a3", "951500" : "5d6d69", "d9c189" : "eacf60", "a38d59" : "c1a24e", "735e3a" : "977841" } - ], - "undyColor" : [], - "hairColor" : [] - } - }, - "armors" : { - "names" : ["adventurer","commoner","fancy","worker", null], - "armorColors" : [ - { "ffca8a" : "d4c398", "e0975c" : "a28959", "a85636" : "715833", "6f2919" : "43331e" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - }, - "apex" : { - "variables" : { - "altOptionAsUndyColor" : true, - "altOptionAsFacialMask" : false, - "headOptionAsHairColor" : false, - "headOptionAsFacialHair" : true, - "names" : [ "furColor", "skinColor", "hairStyle", "beardStyle" ], - "genders" : { - "iconOffset" : 0, - "male" : { - "hair" : { - "offsetY" : 3, - "count" : 25 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : 1, - "count" : 22 - } - }, - "female" : { - "hair" : { - "offsetY" : 5, - "count" : 20 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : 2, - "count" : 15 - } - } - }, - "colors" : { - "skinColor" :[ - { "e0975c" : "7e5938", "a85636" : "5d3e25", "6f2919" : "422a18" }, - { "e0975c" : "595760", "a85636" : "3f3e43", "6f2919" : "212123" }, - { "e0975c" : "d98f30", "a85636" : "a4601e", "6f2919" : "794515" }, - { "e0975c" : "8f4a24", "a85636" : "66351f", "6f2919" : "522b1d" }, - { "e0975c" : "e4f3f3", "a85636" : "a7b9b9", "6f2919" : "7b8888" }, - { "e0975c" : "7e5938", "a85636" : "5d3e25", "6f2919" : "422a18" }, - { "e0975c" : "c43d3d", "a85636" : "961e21", "6f2919" : "751922" }, - { "e0975c" : "597e38", "a85636" : "415d25", "6f2919" : "2e4218" }, - { "e0975c" : "fbf6c4", "a85636" : "cac488", "6f2919" : "959166" } - ], - "undyColor" : [ - { "f7e7b2" : "ffe2c5", "d9c189" : "ffc181", "a38d59" : "d39c6c", "735e3a" : "c7815b" }, - { "f7e7b2" : "f0d6b9", "d9c189" : "e5b078", "a38d59" : "bb8c5e", "735e3a" : "a66c46" }, - { "f7e7b2" : "ecfeff", "d9c189" : "c1e4eb", "a38d59" : "829fc6", "735e3a" : "5c6d86" }, - { "f7e7b2" : "c8cee0", "d9c189" : "a3a7b2", "a38d59" : "7c8094", "735e3a" : "5f5f73" }, - { "f7e7b2" : "d6cecb", "d9c189" : "b6b0ae", "a38d59" : "978d88", "735e3a" : "787069" }, - { "f7e7b2" : "ebcfd2", "d9c189" : "dda9b0", "a38d59" : "c37e80", "735e3a" : "96635c" }, - { "f7e7b2" : "e9c08b", "d9c189" : "d29a5f", "a38d59" : "ac7955", "735e3a" : "8c5d44" }, - { "f7e7b2" : "c6cddf", "d9c189" : "95a0b4", "a38d59" : "727a86", "735e3a" : "5b6165" }, - { "f7e7b2" : "fffdea", "d9c189" : "fff499", "a38d59" : "d4c574", "735e3a" : "bfa458" }, - { "f7e7b2" : "ffd5d6", "d9c189" : "ff9596", "a38d59" : "d4787c", "735e3a" : "bd5767" } - ], - "hairColor" : [] - } - }, - "armors" : { - "names" : ["commander","navy","officer","specialist", null], - "armorColors": [ - { "ffca8a" : "aeb6ab", "e0975c" : "788377", "a85636" : "535d56", "6f2919" : "383f3a" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - }, - "floran" : { - "variables" : { - "altOptionAsUndyColor" : true, - "altOptionAsFacialMask" : false, - "altOptionAshairColor" : true, - "headOptionAsHairColor" : true, - "headOptionAsFacialHair" : false, - "names" : [ "skinColor", "leafColor", "foliage", "flowerColor" ], - "genders" : { - "iconOffset" : 1, - "male" : { - "hair" : { - "offsetY" : 1, - "count" : 39 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : -1, - "count" : -1 - } - }, - "female" : { - "hair" : { - "offsetY" : 1, - "count" : 39 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : -1, - "count" : -1 - } - } - }, - "colors" : { - "skinColor" : [ - { "ffca8a" : "c4d0a5", "e0975c" : "a3af83", "a85636" : "7f8760", "6f2919" : "5e6142" }, - { "ffca8a" : "d08c9f", "e0975c" : "b27082", "a85636" : "874e62", "6f2919" : "603347" }, - { "ffca8a" : "d8d695", "e0975c" : "b9b778", "a85636" : "908a56", "6f2919" : "685f3a" }, - { "ffca8a" : "a6cbd2", "e0975c" : "7ca7af", "a85636" : "558287", "6f2919" : "386362" }, - { "ffca8a" : "cb86d6", "e0975c" : "ac6ab7", "a85636" : "7e498c", "6f2919" : "542f64" }, - { "ffca8a" : "b7d179", "e0975c" : "8eab59", "a85636" : "808a44", "6f2919" : "5e6534" }, - { "ffca8a" : "b9997a", "e0975c" : "9f7761", "a85636" : "85594a", "6f2919" : "6a3e36" }, - { "ffca8a" : "a8c2c4", "e0975c" : "8ba4a6", "a85636" : "677f7f", "6f2919" : "485b59" }, - { "ffca8a" : "e47068", "e0975c" : "c54848", "a85636" : "952f45", "6f2919" : "65223a" }, - { "ffca8a" : "e3da89", "e0975c" : "c5bd6d", "a85636" : "9a8d4c", "6f2919" : "705f32" } - ], - "undyColor" : [ - { "f7e7b2" : "96c072", "d9c189" : "81996c", "a38d59" : "667552", "735e3a" : "515a3f" }, - { "f7e7b2" : "d1ce79", "d9c189" : "a9ab59", "a38d59" : "837d43", "735e3a" : "655c34" }, - { "f7e7b2" : "71c1b4", "d9c189" : "6b9991", "a38d59" : "51756b", "735e3a" : "3e5a50" }, - { "f7e7b2" : "eaa553", "d9c189" : "cc7f39", "a38d59" : "9c552a", "735e3a" : "783920" }, - { "f7e7b2" : "e47068", "d9c189" : "c54848", "a38d59" : "952f45", "735e3a" : "65223a" }, - { "f7e7b2" : "ffe9ef", "d9c189" : "f6bcd2", "a38d59" : "d96d94", "735e3a" : "b0425e" }, - { "f7e7b2" : "71d275", "d9c189" : "55aa57", "a38d59" : "3e803a", "735e3a" : "2f5f2a" }, - { "f7e7b2" : "c19e75", "d9c189" : "a97e5b", "a38d59" : "82563c", "735e3a" : "623c2b" }, - { "f7e7b2" : "e4e568", "d9c189" : "cac056", "a38d59" : "9b8838", "735e3a" : "786025" }, - { "f7e7b2" : "b774be", "d9c189" : "946d98", "a38d59" : "6d5374", "735e3a" : "513f59" } - ], - "hairColor" : [ - { "f32200" : "be5645", "dc1f00" : "972b2b", "be1b00" : "6f191f" }, - { "f32200" : "ebac59", "dc1f00" : "d26434", "be1b00" : "a43829" }, - { "f32200" : "a0d8ea", "dc1f00" : "62a2d2", "be1b00" : "3d6fa3" }, - { "f32200" : "c655c1", "dc1f00" : "92379d", "be1b00" : "60226e" }, - { "f32200" : "818181", "dc1f00" : "616161", "be1b00" : "444444" }, - { "f32200" : "e4e9e9", "dc1f00" : "aeb8b8", "be1b00" : "757d7e" }, - { "f32200" : "e4df6a", "dc1f00" : "b7ab42", "be1b00" : "847629" }, - { "f32200" : "68689a", "dc1f00" : "4b5177", "be1b00" : "323955" }, - { "f32200" : "81996c", "dc1f00" : "667552", "be1b00" : "515a3f" }, - { "f32200" : "f6bcd2", "dc1f00" : "d96d94", "be1b00" : "b0425e" } - ] - } - }, - "armors" : { - "names" : ["furnivour","hunter","leaf","pelt","survivalist", null], - "armorColors" : [ - { "ffca8a" : "ba2c72", "e0975c" : "79173e", "a85636" : "421128", "6f2919" : "220b16" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - }, - "hylotl" : { - "variables" : { - "altOptionAsUndyColor" : true, - "altOptionAsFacialMask" : false, - "altOptionAshairColor" : true, - "headOptionAsHairColor" : true, - "headOptionAsFacialHair" : false, - "hairColorAsBodySubColor" : true, - "names" : [ "skinColor", "bellyColor", "fins", "finColor" ], - "genders" : { - "iconOffset" : 0, - "male" : { - "hair" : { - "offsetY" : 1, - "count" : 31 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : -1, - "count" : -1 - } - }, - "female" : { - "hair" : { - "offsetY" : 1, - "count" : 31 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : -1, - "count" : -1 - } - } - }, - "colors" : { - "skinColor" : [ - { "ffca8a" : "DBF4B8", "e0975c" : "A4D66B", "a85636" : "6F9E47", "6f2919" : "426D26" }, - { "ffca8a" : "B8F4BB", "e0975c" : "72DD7E", "a85636" : "4AA559", "6f2919" : "266535" }, - { "ffca8a" : "F1EABB", "e0975c" : "D8D077", "a85636" : "A09E4E", "6f2919" : "5F6229" }, - { "ffca8a" : "B8F4D9", "e0975c" : "72DDB3", "a85636" : "4AA586", "6f2919" : "266554" }, - { "ffca8a" : "B1F1FE", "e0975c" : "5DD1EC", "a85636" : "3491AA", "6f2919" : "196072" }, - { "ffca8a" : "b5c2fa", "e0975c" : "758bf8", "a85636" : "4a5ba5", "6f2919" : "272665" }, - { "ffca8a" : "E2B2FF", "e0975c" : "B374D4", "a85636" : "7C4992", "6f2919" : "4B2655" }, - { "ffca8a" : "ffffff", "e0975c" : "d7d5db", "a85636" : "8e8e9b", "6f2919" : "6d6d6d" }, - { "ffca8a" : "9E9E9E", "e0975c" : "696969", "a85636" : "434343", "6f2919" : "191919" }, - { "ffca8a" : "F9D9DA", "e0975c" : "EAB2B5", "a85636" : "CC8288", "6f2919" : "A55B61" } - ], - "undyColor" : [ - { "f32200" : "DBF4B8", "dc1f00" : "A4D66B", "be1b00" : "6F9E47", "951500" : "426D26" }, - { "f32200" : "B8F4BB", "dc1f00" : "72DD7E", "be1b00" : "4AA559", "951500" : "266535" }, - { "f32200" : "F1EABB", "dc1f00" : "D8D077", "be1b00" : "A09E4E", "951500" : "5F6229" }, - { "f32200" : "B8F4D9", "dc1f00" : "72DDB3", "be1b00" : "4AA586", "951500" : "266554" }, - { "f32200" : "B1F1FE", "dc1f00" : "5DD1EC", "be1b00" : "3491AA", "951500" : "196072" }, - { "f32200" : "b5c2fa", "dc1f00" : "758bf8", "be1b00" : "4a5ba5", "951500" : "272665" }, - { "f32200" : "E2B2FF", "dc1f00" : "B374D4", "be1b00" : "7C4992", "951500" : "4B2655" }, - { "f32200" : "ffffff", "dc1f00" : "d7d5db", "be1b00" : "8e8e9b", "951500" : "6d6d6d" }, - { "f32200" : "9E9E9E", "dc1f00" : "696969", "be1b00" : "434343", "951500" : "191919" }, - { "f32200" : "F9D9DA", "dc1f00" : "EAB2B5", "be1b00" : "CC8288", "951500" : "A55B61" } - ], - "hairColor" : [ - { "f7e7b2" : "DBF4B8", "d9c189" : "A4D66B", "a38d59" : "6F9E47", "735e3a" : "426D26" }, - { "f7e7b2" : "B8F4BB", "d9c189" : "72DD7E", "a38d59" : "4AA559", "735e3a" : "266535" }, - { "f7e7b2" : "F1EABB", "d9c189" : "D8D077", "a38d59" : "A09E4E", "735e3a" : "5F6229" }, - { "f7e7b2" : "B8F4D9", "d9c189" : "72DDB3", "a38d59" : "4AA586", "735e3a" : "266554" }, - { "f7e7b2" : "B1F1FE", "d9c189" : "5DD1EC", "a38d59" : "3491AA", "735e3a" : "196072" }, - { "f7e7b2" : "b5c2fa", "d9c189" : "758bf8", "a38d59" : "4a5ba5", "735e3a" : "272665" }, - { "f7e7b2" : "E2B2FF", "d9c189" : "B374D4", "a38d59" : "7C4992", "735e3a" : "4B2655" }, - { "f7e7b2" : "ffffff", "d9c189" : "d7d5db", "a38d59" : "8e8e9b", "735e3a" : "6d6d6d" }, - { "f7e7b2" : "9E9E9E", "d9c189" : "696969", "a38d59" : "434343", "735e3a" : "191919" }, - { "f7e7b2" : "F9D9DA", "d9c189" : "EAB2B5", "a38d59" : "CC8288", "735e3a" : "A55B61" } - ] - } - }, - "armors" : { - "names" : ["kimono","monk","traditional","trainee",null], - "armorColors" : [ - { "ffca8a" : "65c1df", "e0975c" : "257e8b", "a85636" : "113f43", "6f2919" : "061818" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - }, - "robot" : { - "variables" : { - "altOptionAsUndyColor" : true, - "altOptionAsFacialMask" : false, - "altOptionAshairColor" : true, - "headOptionAsHairColor" : true, - "headOptionAsFacialHair" : false, - "hairColorAsBodySubColor" : true, - "names" : [ "paintColor", "lightsColor", "headMod", "detailColor" ], - "genders" : { - "iconOffset" : 2, - "male" : { - "hair" : { - "offsetY" : 1, - "count" : 77 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : -1, - "count" : -1 - } - }, - "female" : { - "hair" : { - "offsetY" : 1, - "count" : 77 - }, - "facialMask" : { - "offsetY" : -1, - "count" : -1 - }, - "facialHair" : { - "offsetY" : -1, - "count" : -1 - } - } - }, - "colors" : { - "skinColor" : [ - { "ffca8a" : "f0f0f0", "e0975c" : "b1b1b1", "a85636" : "747474", "6f2919" : "4c4c4c" }, - { "ffca8a" : "d0d4e9", "e0975c" : "90a0cc", "a85636" : "566b86", "6f2919" : "314354" }, - { "ffca8a" : "f6cccc", "e0975c" : "d57979", "a85636" : "98464d", "6f2919" : "632530" }, - { "ffca8a" : "f9f9e9", "e0975c" : "d3d075", "a85636" : "938341", "6f2919" : "5f4d22" }, - { "ffca8a" : "f3d9b8", "e0975c" : "d49c6f", "a85636" : "995c44", "6f2919" : "643024" }, - { "ffca8a" : "e1f6c8", "e0975c" : "9fd776", "a85636" : "4e9944", "6f2919" : "2c6424" }, - { "ffca8a" : "ecd2f2", "e0975c" : "bc8dd0", "a85636" : "70528b", "6f2919" : "412e59" }, - { "ffca8a" : "f8e7f8", "e0975c" : "dca1dc", "a85636" : "9e5a9c", "6f2919" : "683267" }, - { "ffca8a" : "ffffff", "e0975c" : "d5d3d8", "a85636" : "7d7d89", "6f2919" : "515151" }, - { "ffca8a" : "949494", "e0975c" : "696969", "a85636" : "434343", "6f2919" : "0f0f0f" } - ], - "undyColor" : [ - { "f32200" : "ef0000", "dc1f00" : "ae0000" }, - { "f32200" : "f57d00", "dc1f00" : "be6200" }, - { "f32200" : "efea00", "dc1f00" : "b5b200" }, - { "f32200" : "00ef14", "dc1f00" : "00ae0e" }, - { "f32200" : "008df5", "dc1f00" : "0068b3" }, - { "f32200" : "d400ff", "dc1f00" : "b100d6" }, - { "f32200" : "ef00da", "dc1f00" : "c000d1" }, - { "f32200" : "00edef", "dc1f00" : "00acae" }, - { "f32200" : "ef0063", "dc1f00" : "ae0048" }, - { "f32200" : "ffffff", "dc1f00" : "cbcbcb" } - ], - "hairColor" : [ - { "d9c189" : "74665b", "a38d59" : "524840", "735e3a" : "231f1b" }, - { "d9c189" : "536a7c", "a38d59" : "3a4b58", "735e3a" : "181e25" }, - { "d9c189" : "805b4e", "a38d59" : "5b4037", "735e3a" : "271c17" }, - { "d9c189" : "868148", "a38d59" : "5f5b32", "735e3a" : "292915" }, - { "d9c189" : "80704e", "a38d59" : "5b5037", "735e3a" : "272317" }, - { "d9c189" : "6a7c53", "a38d59" : "4b583a", "735e3a" : "1e2518" }, - { "d9c189" : "77537c", "a38d59" : "553a58", "735e3a" : "251825" }, - { "d9c189" : "696969", "a38d59" : "434343", "735e3a" : "0f0f0f" } - ] - } - }, - "armors" : { - "names" : ["craftsmen","merchant","noble","peasant",null], - "armorColors" : [ - { "ffca8a" : "a37e58", "e0975c" : "614d2f", "a85636" : "2d2514", "6f2919" : "161209" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - }, - "novakid" : { - "variables" : { - "altOptionAsUndyColor" : false, - "altOptionAsFacialMask" : true, - "headOptionAsHairColor" : false, - "headOptionAsFacialHair" : true, - "names" : [ "color", "bellyButton", "hair", "brand" ], - "genders" : { - "iconOffset" : 0, - "male" : { - "hair" : { - "offsetY" : 1, - "count" : 20 - }, - "facialMask" : { - "offsetY" : 3, - "count" : 2 - }, - "facialHair" : { - "offsetY" : 4, - "count" : 20 - } - }, - "female" : { - "hair" : { - "offsetY" : 2, - "count" : 20 - }, - "facialMask" : { - "offsetY" : 3, - "count" : 2 - }, - "facialHair" : { - "offsetY" : 4, - "count" : 20 - } - } - }, - "colors" : { - "skinColor" : [ - { "fff8b5" : "fff8b5", "fde03f" : "fde03f", "f6b919" : "f6b919", "806319" : "352b12" }, - { "fff8b5" : "ffedc4", "fde03f" : "feb05c", "f6b919" : "fa8131", "806319" : "40110a" }, - { "fff8b5" : "ffe2c9", "fde03f" : "fe9875", "f6b919" : "ef5443", "806319" : "4f160d" }, - { "fff8b5" : "fee5ff", "fde03f" : "f6bbf9", "f6b919" : "f57afc", "806319" : "4c2153" }, - { "fff8b5" : "fedbff", "fde03f" : "da89f7", "f6b919" : "ae38f1", "806319" : "340e52" }, - { "fff8b5" : "c7feff", "fde03f" : "56ebf8", "f6b919" : "12c2e8", "806319" : "0c2b4b" }, - { "fff8b5" : "c3fffc", "fde03f" : "4df4df", "f6b919" : "0cd6b8", "806319" : "0c482d" }, - { "fff8b5" : "c7ffdc", "fde03f" : "63f574", "f6b919" : "17dc0d", "806319" : "0d500f" }, - { "fff8b5" : "fffdae", "fde03f" : "c9f236", "f6b919" : "8ae100", "806319" : "2d510d" }, - { "fff8b5" : "deffff", "fde03f" : "a2dbdb", "f6b919" : "6ea2a9", "806319" : "222d33" } + "species": { + "human": { + "variables": { + "altOptionAsUndyColor": true, + "altOptionAsFacialMask": false, + "headOptionAsHairColor": true, + "headOptionAsFacialHair": false, + "names": ["skinColor", "undyColor", "hairStyle", "hairColor"], + "genders": { + "iconOffset": 0, + "male": { + "hair": { + "offsetY": 1, + "count": 61 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + }, + "female": { + "hair": { + "offsetY": 4, + "count": 55 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + } + }, + "colors": { + "skinColor": [ + { "ffe2c5": "ffe9d3", "ffc181": "ffc181", "d39c6c": "d39c6c", "c7815b": "b97551" }, + { "ffe2c5": "fff6f6", "ffc181": "f7d5d3", "d39c6c": "d1aaa1", "c7815b": "a27f70" }, + { "ffe2c5": "fff7ec", "ffc181": "f9d3a9", "d39c6c": "d3a57c", "c7815b": "b37c5d" }, + { "ffe2c5": "fbe1d4", "ffc181": "f6baa2", "d39c6c": "cc9582", "c7815b": "ac7261" }, + { "ffe2c5": "f4e0ba", "ffc181": "e9b768", "d39c6c": "c18f54", "c7815b": "a2683d" }, + { "ffe2c5": "e8cebc", "ffc181": "cfa97d", "d39c6c": "ae774b", "c7815b": "804e34" }, + { "ffe2c5": "e1b98d", "ffc181": "c88959", "d39c6c": "9e6a4d", "c7815b": "784930" }, + { "ffe2c5": "c9b181", "ffc181": "ac8348", "d39c6c": "87633f", "c7815b": "694c31" }, + { "ffe2c5": "c5ad98", "ffc181": "a47a59", "d39c6c": "865d40", "c7815b": "66412e" }, + { "ffe2c5": "ab8c77", "ffc181": "86644a", "d39c6c": "684431", "c7815b": "40271d" } + ], + "undyColor": [ + { "dc1f00": "4d76ad", "be1b00": "395187", "951500": "20325b" }, + { "dc1f00": "7c41b8", "be1b00": "6c2f90", "951500": "471962" }, + { "dc1f00": "c63442", "be1b00": "9b2724", "951500": "6a1210" }, + { "dc1f00": "eaa245", "be1b00": "b47020", "951500": "834a0c" }, + { "dc1f00": "e3e13a", "be1b00": "a8a614", "951500": "848008" }, + { "dc1f00": "6ab841", "be1b00": "45902f", "951500": "296219" }, + { "dc1f00": "535353", "be1b00": "363636", "951500": "111111" }, + { "dc1f00": "e6e6e6", "be1b00": "979797", "951500": "6f6f6f" }, + { "dc1f00": "9e9e9e", "be1b00": "6e6e6e", "951500": "434343" }, + { "dc1f00": "f794f8", "be1b00": "d355c1", "951500": "b72c95" } + ], + "hairColor": [ + { "d9c189": "525252", "a38d59": "363636", "735e3a": "161616" }, + { "d9c189": "50422f", "a38d59": "36261e", "735e3a": "170f0d" }, + { "d9c189": "7f5a39", "a38d59": "5b3523", "735e3a": "3b1f15" }, + { "d9c189": "a6671d", "a38d59": "915622", "735e3a": "743e1d" }, + { "d9c189": "e6e756", "a38d59": "c7ac3f", "735e3a": "a9882f" }, + { "d9c189": "f2eba3", "a38d59": "dcd28c", "735e3a": "c2b677" }, + { "d9c189": "7d3c1c", "a38d59": "4d240b", "735e3a": "2d1606" }, + { "d9c189": "ad2716", "a38d59": "8f1f1b", "735e3a": "731a1a" }, + { "d9c189": "b8b8b8", "a38d59": "828282", "735e3a": "555555" }, + { "d9c189": "eaeaea", "a38d59": "b8b8b8", "735e3a": "828282" }, + { "d9c189": "6f6d85", "a38d59": "525269", "735e3a": "3e4352" }, + { "d9c189": "cd72d9", "a38d59": "ac4da6", "735e3a": "913b86" }, + { "d9c189": "425879", "a38d59": "343965", "735e3a": "242247" }, + { "d9c189": "5d8bc7", "a38d59": "4d55b0", "735e3a": "2e2a73" }, + { "d9c189": "653b7f", "a38d59": "562e6a", "735e3a": "3f1d4b" }, + { "d9c189": "7f3b6d", "a38d59": "6a2e53", "735e3a": "4b1d30" }, + { "d9c189": "efa838", "a38d59": "be6d1d", "735e3a": "834012" }, + { "d9c189": "4ece61", "a38d59": "34ae47", "735e3a": "228a38" }, + { "d9c189": "3b7f44", "a38d59": "2e6a38", "735e3a": "1d4b28" }, + { "d9c189": "74726f", "a38d59": "53504d", "735e3a": "2a251e" } + ] + } + }, + "armors": { + "names": ["concept", "cool", "sweatervest", "workout", null], + "armorColors": [ + { "ffca8a": "809ebe", "e0975c": "485971", "a85636": "273040", "6f2919": "11151e" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + }, + "avian": { + "variables": { + "altOptionAsUndyColor": false, + "altOptionAsFacialMask": true, + "headOptionAsHairColor": false, + "headOptionAsFacialHair": true, + "names": ["featherColor", "beakStyle", "plumage", "fluff"], + "genders": { + "iconOffset": 0, + "male": { + "hair": { + "offsetY": 3, + "count": 24 + }, + "facialMask": { + "offsetY": 1, + "count": 10 + }, + "facialHair": { + "offsetY": 2, + "count": 10 + } + }, + "female": { + "hair": { + "offsetY": 3, + "count": 24 + }, + "facialMask": { + "offsetY": 1, + "count": 10 + }, + "facialHair": { + "offsetY": 2, + "count": 10 + } + } + }, + "colors": { + "skinColor": [ + { + "ffca8a": "f0608b", + "e0975c": "cd5061", + "a85636": "95484c", + "6f2919": "6a3836", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eacf60", + "a38d59": "c1a24e", + "735e3a": "977841" + }, + { + "ffca8a": "7fdadd", + "e0975c": "61aebf", + "a85636": "4e7a90", + "6f2919": "3f566e", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eacf60", + "a38d59": "c1a24e", + "735e3a": "977841" + }, + { + "ffca8a": "add068", + "e0975c": "85ac1b", + "a85636": "6e8210", + "6f2919": "596809", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eacf60", + "a38d59": "c1a24e", + "735e3a": "977841" + }, + { + "ffca8a": "f3efa3", + "e0975c": "e3d965", + "a85636": "baa94a", + "6f2919": "98832d", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "efad56", + "a38d59": "c5813e", + "735e3a": "9b6638" + }, + { + "ffca8a": "998779", + "e0975c": "836752", + "a85636": "625244", + "6f2919": "4e3b2e", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "efad56", + "a38d59": "c5813e", + "735e3a": "9b6638" + }, + { + "ffca8a": "737275", + "e0975c": "595760", + "a85636": "3f3e43", + "6f2919": "212123", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eacf60", + "a38d59": "c1a24e", + "735e3a": "977841" + }, + { + "ffca8a": "eebfea", + "e0975c": "de8ddd", + "a85636": "c060bb", + "6f2919": "9a4b9c", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eae660", + "a38d59": "c1b54e", + "735e3a": "978841" + }, + { + "ffca8a": "d18bd5", + "e0975c": "a766bc", + "a85636": "814797", + "6f2919": "693367", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "efad56", + "a38d59": "c5813e", + "735e3a": "9b6638" + }, + { + "ffca8a": "f3c873", + "e0975c": "db9c38", + "a85636": "b17628", + "6f2919": "89561f", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eae660", + "a38d59": "c1b54e", + "735e3a": "978841" + }, + { + "ffca8a": "deeded", + "e0975c": "c5d8d8", + "a85636": "96aba9", + "6f2919": "6f807e", + "f32200": "f6fbfb", + "dc1f00": "d7e8e8", + "be1b00": "8fa7a3", + "951500": "5d6d69", + "d9c189": "eacf60", + "a38d59": "c1a24e", + "735e3a": "977841" + } + ], + "undyColor": [], + "hairColor": [] + } + }, + "armors": { + "names": ["adventurer", "commoner", "fancy", "worker", null], + "armorColors": [ + { "ffca8a": "d4c398", "e0975c": "a28959", "a85636": "715833", "6f2919": "43331e" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + }, + "apex": { + "variables": { + "altOptionAsUndyColor": true, + "altOptionAsFacialMask": false, + "headOptionAsHairColor": false, + "headOptionAsFacialHair": true, + "names": ["furColor", "skinColor", "hairStyle", "beardStyle"], + "genders": { + "iconOffset": 0, + "male": { + "hair": { + "offsetY": 3, + "count": 25 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": 1, + "count": 22 + } + }, + "female": { + "hair": { + "offsetY": 5, + "count": 20 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": 2, + "count": 15 + } + } + }, + "colors": { + "skinColor": [ + { "e0975c": "7e5938", "a85636": "5d3e25", "6f2919": "422a18" }, + { "e0975c": "595760", "a85636": "3f3e43", "6f2919": "212123" }, + { "e0975c": "d98f30", "a85636": "a4601e", "6f2919": "794515" }, + { "e0975c": "8f4a24", "a85636": "66351f", "6f2919": "522b1d" }, + { "e0975c": "e4f3f3", "a85636": "a7b9b9", "6f2919": "7b8888" }, + { "e0975c": "7e5938", "a85636": "5d3e25", "6f2919": "422a18" }, + { "e0975c": "c43d3d", "a85636": "961e21", "6f2919": "751922" }, + { "e0975c": "597e38", "a85636": "415d25", "6f2919": "2e4218" }, + { "e0975c": "fbf6c4", "a85636": "cac488", "6f2919": "959166" } + ], + "undyColor": [ + { "f7e7b2": "ffe2c5", "d9c189": "ffc181", "a38d59": "d39c6c", "735e3a": "c7815b" }, + { "f7e7b2": "f0d6b9", "d9c189": "e5b078", "a38d59": "bb8c5e", "735e3a": "a66c46" }, + { "f7e7b2": "ecfeff", "d9c189": "c1e4eb", "a38d59": "829fc6", "735e3a": "5c6d86" }, + { "f7e7b2": "c8cee0", "d9c189": "a3a7b2", "a38d59": "7c8094", "735e3a": "5f5f73" }, + { "f7e7b2": "d6cecb", "d9c189": "b6b0ae", "a38d59": "978d88", "735e3a": "787069" }, + { "f7e7b2": "ebcfd2", "d9c189": "dda9b0", "a38d59": "c37e80", "735e3a": "96635c" }, + { "f7e7b2": "e9c08b", "d9c189": "d29a5f", "a38d59": "ac7955", "735e3a": "8c5d44" }, + { "f7e7b2": "c6cddf", "d9c189": "95a0b4", "a38d59": "727a86", "735e3a": "5b6165" }, + { "f7e7b2": "fffdea", "d9c189": "fff499", "a38d59": "d4c574", "735e3a": "bfa458" }, + { "f7e7b2": "ffd5d6", "d9c189": "ff9596", "a38d59": "d4787c", "735e3a": "bd5767" } + ], + "hairColor": [] + } + }, + "armors": { + "names": ["commander", "navy", "officer", "specialist", null], + "armorColors": [ + { "ffca8a": "aeb6ab", "e0975c": "788377", "a85636": "535d56", "6f2919": "383f3a" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + }, + "floran": { + "variables": { + "altOptionAsUndyColor": true, + "altOptionAsFacialMask": false, + "altOptionAshairColor": true, + "headOptionAsHairColor": true, + "headOptionAsFacialHair": false, + "names": ["skinColor", "leafColor", "foliage", "flowerColor"], + "genders": { + "iconOffset": 1, + "male": { + "hair": { + "offsetY": 1, + "count": 39 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + }, + "female": { + "hair": { + "offsetY": 1, + "count": 39 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + } + }, + "colors": { + "skinColor": [ + { "ffca8a": "c4d0a5", "e0975c": "a3af83", "a85636": "7f8760", "6f2919": "5e6142" }, + { "ffca8a": "d08c9f", "e0975c": "b27082", "a85636": "874e62", "6f2919": "603347" }, + { "ffca8a": "d8d695", "e0975c": "b9b778", "a85636": "908a56", "6f2919": "685f3a" }, + { "ffca8a": "a6cbd2", "e0975c": "7ca7af", "a85636": "558287", "6f2919": "386362" }, + { "ffca8a": "cb86d6", "e0975c": "ac6ab7", "a85636": "7e498c", "6f2919": "542f64" }, + { "ffca8a": "b7d179", "e0975c": "8eab59", "a85636": "808a44", "6f2919": "5e6534" }, + { "ffca8a": "b9997a", "e0975c": "9f7761", "a85636": "85594a", "6f2919": "6a3e36" }, + { "ffca8a": "a8c2c4", "e0975c": "8ba4a6", "a85636": "677f7f", "6f2919": "485b59" }, + { "ffca8a": "e47068", "e0975c": "c54848", "a85636": "952f45", "6f2919": "65223a" }, + { "ffca8a": "e3da89", "e0975c": "c5bd6d", "a85636": "9a8d4c", "6f2919": "705f32" } + ], + "undyColor": [ + { "f7e7b2": "96c072", "d9c189": "81996c", "a38d59": "667552", "735e3a": "515a3f" }, + { "f7e7b2": "d1ce79", "d9c189": "a9ab59", "a38d59": "837d43", "735e3a": "655c34" }, + { "f7e7b2": "71c1b4", "d9c189": "6b9991", "a38d59": "51756b", "735e3a": "3e5a50" }, + { "f7e7b2": "eaa553", "d9c189": "cc7f39", "a38d59": "9c552a", "735e3a": "783920" }, + { "f7e7b2": "e47068", "d9c189": "c54848", "a38d59": "952f45", "735e3a": "65223a" }, + { "f7e7b2": "ffe9ef", "d9c189": "f6bcd2", "a38d59": "d96d94", "735e3a": "b0425e" }, + { "f7e7b2": "71d275", "d9c189": "55aa57", "a38d59": "3e803a", "735e3a": "2f5f2a" }, + { "f7e7b2": "c19e75", "d9c189": "a97e5b", "a38d59": "82563c", "735e3a": "623c2b" }, + { "f7e7b2": "e4e568", "d9c189": "cac056", "a38d59": "9b8838", "735e3a": "786025" }, + { "f7e7b2": "b774be", "d9c189": "946d98", "a38d59": "6d5374", "735e3a": "513f59" } + ], + "hairColor": [ + { "f32200": "be5645", "dc1f00": "972b2b", "be1b00": "6f191f" }, + { "f32200": "ebac59", "dc1f00": "d26434", "be1b00": "a43829" }, + { "f32200": "a0d8ea", "dc1f00": "62a2d2", "be1b00": "3d6fa3" }, + { "f32200": "c655c1", "dc1f00": "92379d", "be1b00": "60226e" }, + { "f32200": "818181", "dc1f00": "616161", "be1b00": "444444" }, + { "f32200": "e4e9e9", "dc1f00": "aeb8b8", "be1b00": "757d7e" }, + { "f32200": "e4df6a", "dc1f00": "b7ab42", "be1b00": "847629" }, + { "f32200": "68689a", "dc1f00": "4b5177", "be1b00": "323955" }, + { "f32200": "81996c", "dc1f00": "667552", "be1b00": "515a3f" }, + { "f32200": "f6bcd2", "dc1f00": "d96d94", "be1b00": "b0425e" } + ] + } + }, + "armors": { + "names": ["furnivour", "hunter", "leaf", "pelt", "survivalist", null], + "armorColors": [ + { "ffca8a": "ba2c72", "e0975c": "79173e", "a85636": "421128", "6f2919": "220b16" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + }, + "hylotl": { + "variables": { + "altOptionAsUndyColor": true, + "altOptionAsFacialMask": false, + "altOptionAshairColor": true, + "headOptionAsHairColor": true, + "headOptionAsFacialHair": false, + "hairColorAsBodySubColor": true, + "names": ["skinColor", "bellyColor", "fins", "finColor"], + "genders": { + "iconOffset": 0, + "male": { + "hair": { + "offsetY": 1, + "count": 31 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + }, + "female": { + "hair": { + "offsetY": 1, + "count": 31 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + } + }, + "colors": { + "skinColor": [ + { "ffca8a": "DBF4B8", "e0975c": "A4D66B", "a85636": "6F9E47", "6f2919": "426D26" }, + { "ffca8a": "B8F4BB", "e0975c": "72DD7E", "a85636": "4AA559", "6f2919": "266535" }, + { "ffca8a": "F1EABB", "e0975c": "D8D077", "a85636": "A09E4E", "6f2919": "5F6229" }, + { "ffca8a": "B8F4D9", "e0975c": "72DDB3", "a85636": "4AA586", "6f2919": "266554" }, + { "ffca8a": "B1F1FE", "e0975c": "5DD1EC", "a85636": "3491AA", "6f2919": "196072" }, + { "ffca8a": "b5c2fa", "e0975c": "758bf8", "a85636": "4a5ba5", "6f2919": "272665" }, + { "ffca8a": "E2B2FF", "e0975c": "B374D4", "a85636": "7C4992", "6f2919": "4B2655" }, + { "ffca8a": "ffffff", "e0975c": "d7d5db", "a85636": "8e8e9b", "6f2919": "6d6d6d" }, + { "ffca8a": "9E9E9E", "e0975c": "696969", "a85636": "434343", "6f2919": "191919" }, + { "ffca8a": "F9D9DA", "e0975c": "EAB2B5", "a85636": "CC8288", "6f2919": "A55B61" } + ], + "undyColor": [ + { "f32200": "DBF4B8", "dc1f00": "A4D66B", "be1b00": "6F9E47", "951500": "426D26" }, + { "f32200": "B8F4BB", "dc1f00": "72DD7E", "be1b00": "4AA559", "951500": "266535" }, + { "f32200": "F1EABB", "dc1f00": "D8D077", "be1b00": "A09E4E", "951500": "5F6229" }, + { "f32200": "B8F4D9", "dc1f00": "72DDB3", "be1b00": "4AA586", "951500": "266554" }, + { "f32200": "B1F1FE", "dc1f00": "5DD1EC", "be1b00": "3491AA", "951500": "196072" }, + { "f32200": "b5c2fa", "dc1f00": "758bf8", "be1b00": "4a5ba5", "951500": "272665" }, + { "f32200": "E2B2FF", "dc1f00": "B374D4", "be1b00": "7C4992", "951500": "4B2655" }, + { "f32200": "ffffff", "dc1f00": "d7d5db", "be1b00": "8e8e9b", "951500": "6d6d6d" }, + { "f32200": "9E9E9E", "dc1f00": "696969", "be1b00": "434343", "951500": "191919" }, + { "f32200": "F9D9DA", "dc1f00": "EAB2B5", "be1b00": "CC8288", "951500": "A55B61" } + ], + "hairColor": [ + { "f7e7b2": "DBF4B8", "d9c189": "A4D66B", "a38d59": "6F9E47", "735e3a": "426D26" }, + { "f7e7b2": "B8F4BB", "d9c189": "72DD7E", "a38d59": "4AA559", "735e3a": "266535" }, + { "f7e7b2": "F1EABB", "d9c189": "D8D077", "a38d59": "A09E4E", "735e3a": "5F6229" }, + { "f7e7b2": "B8F4D9", "d9c189": "72DDB3", "a38d59": "4AA586", "735e3a": "266554" }, + { "f7e7b2": "B1F1FE", "d9c189": "5DD1EC", "a38d59": "3491AA", "735e3a": "196072" }, + { "f7e7b2": "b5c2fa", "d9c189": "758bf8", "a38d59": "4a5ba5", "735e3a": "272665" }, + { "f7e7b2": "E2B2FF", "d9c189": "B374D4", "a38d59": "7C4992", "735e3a": "4B2655" }, + { "f7e7b2": "ffffff", "d9c189": "d7d5db", "a38d59": "8e8e9b", "735e3a": "6d6d6d" }, + { "f7e7b2": "9E9E9E", "d9c189": "696969", "a38d59": "434343", "735e3a": "191919" }, + { "f7e7b2": "F9D9DA", "d9c189": "EAB2B5", "a38d59": "CC8288", "735e3a": "A55B61" } + ] + } + }, + "armors": { + "names": ["kimono", "monk", "traditional", "trainee", null], + "armorColors": [ + { "ffca8a": "65c1df", "e0975c": "257e8b", "a85636": "113f43", "6f2919": "061818" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + }, + "glitch": { + "variables": { + "altOptionAsUndyColor": true, + "altOptionAsFacialMask": false, + "altOptionAshairColor": true, + "headOptionAsHairColor": true, + "headOptionAsFacialHair": false, + "hairColorAsBodySubColor": true, + "names": ["paintColor", "lightsColor", "headMod", "detailColor"], + "genders": { + "iconOffset": 2, + "male": { + "hair": { + "offsetY": 1, + "count": 77 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + }, + "female": { + "hair": { + "offsetY": 1, + "count": 77 + }, + "facialMask": { + "offsetY": -1, + "count": -1 + }, + "facialHair": { + "offsetY": -1, + "count": -1 + } + } + }, + "colors": { + "skinColor": [ + { "ffca8a": "f0f0f0", "e0975c": "b1b1b1", "a85636": "747474", "6f2919": "4c4c4c" }, + { "ffca8a": "d0d4e9", "e0975c": "90a0cc", "a85636": "566b86", "6f2919": "314354" }, + { "ffca8a": "f6cccc", "e0975c": "d57979", "a85636": "98464d", "6f2919": "632530" }, + { "ffca8a": "f9f9e9", "e0975c": "d3d075", "a85636": "938341", "6f2919": "5f4d22" }, + { "ffca8a": "f3d9b8", "e0975c": "d49c6f", "a85636": "995c44", "6f2919": "643024" }, + { "ffca8a": "e1f6c8", "e0975c": "9fd776", "a85636": "4e9944", "6f2919": "2c6424" }, + { "ffca8a": "ecd2f2", "e0975c": "bc8dd0", "a85636": "70528b", "6f2919": "412e59" }, + { "ffca8a": "f8e7f8", "e0975c": "dca1dc", "a85636": "9e5a9c", "6f2919": "683267" }, + { "ffca8a": "ffffff", "e0975c": "d5d3d8", "a85636": "7d7d89", "6f2919": "515151" }, + { "ffca8a": "949494", "e0975c": "696969", "a85636": "434343", "6f2919": "0f0f0f" } + ], + "undyColor": [ + { "f32200": "ef0000", "dc1f00": "ae0000" }, + { "f32200": "f57d00", "dc1f00": "be6200" }, + { "f32200": "efea00", "dc1f00": "b5b200" }, + { "f32200": "00ef14", "dc1f00": "00ae0e" }, + { "f32200": "008df5", "dc1f00": "0068b3" }, + { "f32200": "d400ff", "dc1f00": "b100d6" }, + { "f32200": "ef00da", "dc1f00": "c000d1" }, + { "f32200": "00edef", "dc1f00": "00acae" }, + { "f32200": "ef0063", "dc1f00": "ae0048" }, + { "f32200": "ffffff", "dc1f00": "cbcbcb" } + ], + "hairColor": [ + { "d9c189": "74665b", "a38d59": "524840", "735e3a": "231f1b" }, + { "d9c189": "536a7c", "a38d59": "3a4b58", "735e3a": "181e25" }, + { "d9c189": "805b4e", "a38d59": "5b4037", "735e3a": "271c17" }, + { "d9c189": "868148", "a38d59": "5f5b32", "735e3a": "292915" }, + { "d9c189": "80704e", "a38d59": "5b5037", "735e3a": "272317" }, + { "d9c189": "6a7c53", "a38d59": "4b583a", "735e3a": "1e2518" }, + { "d9c189": "77537c", "a38d59": "553a58", "735e3a": "251825" }, + { "d9c189": "696969", "a38d59": "434343", "735e3a": "0f0f0f" } + ] + } + }, + "armors": { + "names": ["craftsmen", "merchant", "noble", "peasant", null], + "armorColors": [ + { "ffca8a": "a37e58", "e0975c": "614d2f", "a85636": "2d2514", "6f2919": "161209" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + }, + "novakid": { + "variables": { + "altOptionAsUndyColor": false, + "altOptionAsFacialMask": true, + "headOptionAsHairColor": false, + "headOptionAsFacialHair": true, + "names": ["color", "bellyButton", "hair", "brand"], + "genders": { + "iconOffset": 0, + "male": { + "hair": { + "offsetY": 1, + "count": 20 + }, + "facialMask": { + "offsetY": 3, + "count": 2 + }, + "facialHair": { + "offsetY": 4, + "count": 20 + } + }, + "female": { + "hair": { + "offsetY": 2, + "count": 20 + }, + "facialMask": { + "offsetY": 3, + "count": 2 + }, + "facialHair": { + "offsetY": 4, + "count": 20 + } + } + }, + "colors": { + "skinColor": [ + { "fff8b5": "fff8b5", "fde03f": "fde03f", "f6b919": "f6b919", "806319": "352b12" }, + { "fff8b5": "ffedc4", "fde03f": "feb05c", "f6b919": "fa8131", "806319": "40110a" }, + { "fff8b5": "ffe2c9", "fde03f": "fe9875", "f6b919": "ef5443", "806319": "4f160d" }, + { "fff8b5": "fee5ff", "fde03f": "f6bbf9", "f6b919": "f57afc", "806319": "4c2153" }, + { "fff8b5": "fedbff", "fde03f": "da89f7", "f6b919": "ae38f1", "806319": "340e52" }, + { "fff8b5": "c7feff", "fde03f": "56ebf8", "f6b919": "12c2e8", "806319": "0c2b4b" }, + { "fff8b5": "c3fffc", "fde03f": "4df4df", "f6b919": "0cd6b8", "806319": "0c482d" }, + { "fff8b5": "c7ffdc", "fde03f": "63f574", "f6b919": "17dc0d", "806319": "0d500f" }, + { "fff8b5": "fffdae", "fde03f": "c9f236", "f6b919": "8ae100", "806319": "2d510d" }, + { "fff8b5": "deffff", "fde03f": "a2dbdb", "f6b919": "6ea2a9", "806319": "222d33" } + ], + "undyColor": [ + { "f32200": "FFDCC4", "dc1f00": "FFB98F", "be1b00": "C1695F", "951500": "7E3F38" }, + { "f32200": "FFFFE7", "dc1f00": "FFE48E", "be1b00": "C1AA5C", "951500": "7C7135" }, + { "f32200": "F6F0D3", "dc1f00": "DAD39B", "be1b00": "A7A270", "951500": "6B6B47" }, + { "f32200": "FFFFE0", "dc1f00": "E7EFA1", "be1b00": "ABB573", "951500": "697447" }, + { "f32200": "EEFFDC", "dc1f00": "B1E994", "be1b00": "7CAD69", "951500": "4F7B43" }, + { "f32200": "C7DEBC", "dc1f00": "90BC80", "be1b00": "648B5A", "951500": "3A5D35" }, + { "f32200": "DAFFE5", "dc1f00": "97ECB0", "be1b00": "6BB383", "951500": "417356" }, + { "f32200": "DBFFFE", "dc1f00": "99EEDB", "be1b00": "6DB4A9", "951500": "427470" }, + { "f32200": "D4FDFF", "dc1f00": "85CCF5", "be1b00": "558DB2", "951500": "36627C" }, + { "f32200": "D0D0FF", "dc1f00": "9290F8", "be1b00": "6060A9", "951500": "43396B" }, + { "f32200": "FFD1FF", "dc1f00": "D191DE", "be1b00": "95629C", "951500": "603B61" }, + { "f32200": "FFF4FF", "dc1f00": "FFCDEA", "be1b00": "E19CC4", "951500": "B8739B" }, + { "f32200": "FFFAF6", "dc1f00": "FBD5CF", "be1b00": "D9A49E", "951500": "B07B74" }, + { "f32200": "CECBC2", "dc1f00": "A89B89", "be1b00": "74665A", "951500": "463D34" }, + { "f32200": "B4B3AD", "dc1f00": "8A897A", "be1b00": "4E4F42", "951500": "2C2915" }, + { "f32200": "FFFFFF", "dc1f00": "F2EFF3", "be1b00": "A6A4AE", "951500": "818181" } + ], + "hairColor": [ + { "f7e7b2": "FFB0A3", "d9c189": "FC8469", "a38d59": "BE424D", "735e3a": "782027" }, + { "f7e7b2": "FFEBC2", "d9c189": "F6B060", "a38d59": "B37F34", "735e3a": "6D5013" }, + { "f7e7b2": "DFCFB3", "d9c189": "C7AE76", "a38d59": "94824F", "735e3a": "5A512B" }, + { "f7e7b2": "F1EABB", "d9c189": "D8D077", "a38d59": "A09E4E", "735e3a": "5F6229" }, + { "f7e7b2": "DBF4B8", "d9c189": "A4D66B", "a38d59": "6F9E47", "735e3a": "426D26" }, + { "f7e7b2": "B3C89E", "d9c189": "82AB5F", "a38d59": "547A3C", "735e3a": "2D4F1D" }, + { "f7e7b2": "B8F4BB", "d9c189": "72DD7E", "a38d59": "4AA559", "735e3a": "266535" }, + { "f7e7b2": "B8F4D9", "d9c189": "72DDB3", "a38d59": "4AA586", "735e3a": "266554" }, + { "f7e7b2": "B1F1FE", "d9c189": "5DD1EC", "a38d59": "3491AA", "735e3a": "196072" }, + { "f7e7b2": "B5C2FA", "d9c189": "758BF8", "a38d59": "4A5BA5", "735e3a": "272665" }, + { "f7e7b2": "E2B2FF", "d9c189": "B374D4", "a38d59": "7C4992", "735e3a": "4B2655" }, + { "f7e7b2": "FDD8F2", "d9c189": "F1AFDF", "a38d59": "D67EC1", "735e3a": "AF579A" }, + { "f7e7b2": "F9D9DA", "d9c189": "EAB2B5", "a38d59": "CC8288", "735e3a": "A55B61" }, + { "f7e7b2": "B8B0A8", "d9c189": "967E6E", "a38d59": "654D43", "735e3a": "372720" }, + { "f7e7b2": "9E9B94", "d9c189": "767162", "a38d59": "3F3C2E", "735e3a": "1E1400" }, + { "f7e7b2": "FFFFFF", "d9c189": "D7D5DB", "a38d59": "8E8E9B", "735e3a": "6D6D6D" } + ] + } + }, + "armors": { + "names": ["fancy", "jacket", "suspenders", "waistcoat", null], + "armorColors": [ + { "ffca8a": "a37e58", "e0975c": "614d2f", "a85636": "2d2514", "6f2919": "161209" }, + { "ffca8a": "727272", "e0975c": "414141", "a85636": "1c1c1c", "6f2919": "0b0b0b" }, + { "ffca8a": "e9e9e9", "e0975c": "727272", "a85636": "333333", "6f2919": "161616" }, + { "ffca8a": "ba3f36", "e0975c": "7a2622", "a85636": "411114", "6f2919": "25090c" }, + { "ffca8a": "d77b24", "e0975c": "794317", "a85636": "3a1f0f", "6f2919": "1d1009" }, + { "ffca8a": "eedb53", "e0975c": "928132", "a85636": "42381a", "6f2919": "262010" }, + { "ffca8a": "6c9e4a", "e0975c": "395b2b", "a85636": "1b2e16", "6f2919": "0b140a" }, + { "ffca8a": "4681c0", "e0975c": "284672", "a85636": "161b3b", "6f2919": "0c0e22" }, + { "ffca8a": "7d4794", "e0975c": "4d245d", "a85636": "221328", "6f2919": "0f0912" }, + { "ffca8a": "d46bd7", "e0975c": "7c377b", "a85636": "30172e", "6f2919": "170b16" }, + { "ffca8a": "a36948", "e0975c": "683a23", "a85636": "2d1a12", "6f2919": "170d09" } + ] + } + } + }, + "sharedOptions": ["shirtStyle", "shirtColor", "pantsStyle", "pantsColor", "pose", "helmet"], - ], - "undyColor" : [ - { "f32200" : "FFDCC4", "dc1f00" : "FFB98F", "be1b00" : "C1695F", "951500" : "7E3F38" }, - { "f32200" : "FFFFE7", "dc1f00" : "FFE48E", "be1b00" : "C1AA5C", "951500" : "7C7135" }, - { "f32200" : "F6F0D3", "dc1f00" : "DAD39B", "be1b00" : "A7A270", "951500" : "6B6B47" }, - { "f32200" : "FFFFE0", "dc1f00" : "E7EFA1", "be1b00" : "ABB573", "951500" : "697447" }, - { "f32200" : "EEFFDC", "dc1f00" : "B1E994", "be1b00" : "7CAD69", "951500" : "4F7B43" }, - { "f32200" : "C7DEBC", "dc1f00" : "90BC80", "be1b00" : "648B5A", "951500" : "3A5D35" }, - { "f32200" : "DAFFE5", "dc1f00" : "97ECB0", "be1b00" : "6BB383", "951500" : "417356" }, - { "f32200" : "DBFFFE", "dc1f00" : "99EEDB", "be1b00" : "6DB4A9", "951500" : "427470" }, - { "f32200" : "D4FDFF", "dc1f00" : "85CCF5", "be1b00" : "558DB2", "951500" : "36627C" }, - { "f32200" : "D0D0FF", "dc1f00" : "9290F8", "be1b00" : "6060A9", "951500" : "43396B" }, - { "f32200" : "FFD1FF", "dc1f00" : "D191DE", "be1b00" : "95629C", "951500" : "603B61" }, - { "f32200" : "FFF4FF", "dc1f00" : "FFCDEA", "be1b00" : "E19CC4", "951500" : "B8739B" }, - { "f32200" : "FFFAF6", "dc1f00" : "FBD5CF", "be1b00" : "D9A49E", "951500" : "B07B74" }, - { "f32200" : "CECBC2", "dc1f00" : "A89B89", "be1b00" : "74665A", "951500" : "463D34" }, - { "f32200" : "B4B3AD", "dc1f00" : "8A897A", "be1b00" : "4E4F42", "951500" : "2C2915" }, - { "f32200" : "FFFFFF", "dc1f00" : "F2EFF3", "be1b00" : "A6A4AE", "951500" : "818181" } - ], - "hairColor" : [ - { "f7e7b2" : "FFB0A3", "d9c189" : "FC8469", "a38d59" : "BE424D", "735e3a" : "782027" }, - { "f7e7b2" : "FFEBC2", "d9c189" : "F6B060", "a38d59" : "B37F34", "735e3a" : "6D5013" }, - { "f7e7b2" : "DFCFB3", "d9c189" : "C7AE76", "a38d59" : "94824F", "735e3a" : "5A512B" }, - { "f7e7b2" : "F1EABB", "d9c189" : "D8D077", "a38d59" : "A09E4E", "735e3a" : "5F6229" }, - { "f7e7b2" : "DBF4B8", "d9c189" : "A4D66B", "a38d59" : "6F9E47", "735e3a" : "426D26" }, - { "f7e7b2" : "B3C89E", "d9c189" : "82AB5F", "a38d59" : "547A3C", "735e3a" : "2D4F1D" }, - { "f7e7b2" : "B8F4BB", "d9c189" : "72DD7E", "a38d59" : "4AA559", "735e3a" : "266535" }, - { "f7e7b2" : "B8F4D9", "d9c189" : "72DDB3", "a38d59" : "4AA586", "735e3a" : "266554" }, - { "f7e7b2" : "B1F1FE", "d9c189" : "5DD1EC", "a38d59" : "3491AA", "735e3a" : "196072" }, - { "f7e7b2" : "B5C2FA", "d9c189" : "758BF8", "a38d59" : "4A5BA5", "735e3a" : "272665" }, - { "f7e7b2" : "E2B2FF", "d9c189" : "B374D4", "a38d59" : "7C4992", "735e3a" : "4B2655" }, - { "f7e7b2" : "FDD8F2", "d9c189" : "F1AFDF", "a38d59" : "D67EC1", "735e3a" : "AF579A" }, - { "f7e7b2" : "F9D9DA", "d9c189" : "EAB2B5", "a38d59" : "CC8288", "735e3a" : "A55B61" }, - { "f7e7b2" : "B8B0A8", "d9c189" : "967E6E", "a38d59" : "654D43", "735e3a" : "372720" }, - { "f7e7b2" : "9E9B94", "d9c189" : "767162", "a38d59" : "3F3C2E", "735e3a" : "1E1400" }, - { "f7e7b2" : "FFFFFF", "d9c189" : "D7D5DB", "a38d59" : "8E8E9B", "735e3a" : "6D6D6D" } - ] - } - }, - "armors" : { - "names" : ["fancy", "jacket", "suspenders", "waistcoat",null], - "armorColors" : [ - { "ffca8a" : "a37e58", "e0975c" : "614d2f", "a85636" : "2d2514", "6f2919" : "161209" }, - { "ffca8a" : "727272", "e0975c" : "414141", "a85636" : "1c1c1c", "6f2919" : "0b0b0b" }, - { "ffca8a" : "e9e9e9", "e0975c" : "727272", "a85636" : "333333", "6f2919" : "161616" }, - { "ffca8a" : "ba3f36", "e0975c" : "7a2622", "a85636" : "411114", "6f2919" : "25090c" }, - { "ffca8a" : "d77b24", "e0975c" : "794317", "a85636" : "3a1f0f", "6f2919" : "1d1009" }, - { "ffca8a" : "eedb53", "e0975c" : "928132", "a85636" : "42381a", "6f2919" : "262010" }, - { "ffca8a" : "6c9e4a", "e0975c" : "395b2b", "a85636" : "1b2e16", "6f2919" : "0b140a" }, - { "ffca8a" : "4681c0", "e0975c" : "284672", "a85636" : "161b3b", "6f2919" : "0c0e22" }, - { "ffca8a" : "7d4794", "e0975c" : "4d245d", "a85636" : "221328", "6f2919" : "0f0912" }, - { "ffca8a" : "d46bd7", "e0975c" : "7c377b", "a85636" : "30172e", "6f2919" : "170b16" }, - { "ffca8a" : "a36948", "e0975c" : "683a23", "a85636" : "2d1a12", "6f2919" : "170d09" } - ] - } - } - }, - "sharedOptions" : ["shirtStyle","shirtColor","pantsStyle","pantsColor", "pose", "helmet"], - - "poses" : [ - { - "name" : "personality-1", - "index" : 1, - "bodyIndex" : [ 1, 0 ], - "sleeveIndex" : [ 1, 0 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 0, 0 ] - }, - { - "name" : "personality-2", - "index" : 2, - "bodyIndex" : [ 2, 0 ], - "sleeveIndex" : [ 2, 0 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 0, 1 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ -1, 0 ] - }, - { - "name" : "personality-3", - "index" : 3, - "bodyIndex" : [ 3, 0 ], - "sleeveIndex" : [ 3, 0 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 1 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ -1, 0 ] - }, - { - "name" : "personality-4", - "index" : 4, - "bodyIndex" : [ 4, 0 ], - "sleeveIndex" : [ 4, 0 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 0, 1 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ -1, 0 ] - }, - { - "name" : "personality-5", - "index" : 5, - "bodyIndex" : [ 5, 0 ], - "sleeveIndex" : [ 5, 0 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 0, 0 ] - }, - { - "name" : "sitting", - "index" : 6, - "bodyIndex" : [ 6, 0 ], - "sleeveIndex" : [ 1, 0 ], - "sleeveOffset" : [ 0, 1 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 0, 1 ] - }, - { - "name" : "ducking", - "index" : 7, - "bodyIndex" : [ 8, 0 ], - "sleeveIndex" : [ 8, 0 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 3 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 8 ] - }, - { - "name" : "walk-1", - "index" : 8, - "bodyIndex" : [ 1, 1 ], - "sleeveIndex" : [ 3, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 0, 1 ] - }, - { - "name" : "walk-2", - "index" : 9, - "bodyIndex" : [ 2, 1 ], - "sleeveIndex" : [ 2, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 2 ], - "hairOffset" : [ 0, 2 ] - }, - { - "name" : "walk-3", - "index" : 10, - "bodyIndex" : [ 3, 1 ], - "sleeveIndex" : [ 3, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 0, 1 ] - }, - { - "name" : "walk-4", - "index" : 11, - "bodyIndex" : [ 4, 1 ], - "sleeveIndex" : [ 4, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 0, 0 ] - }, - { - "name" : "walk-5", - "index" : 12, - "bodyIndex" : [ 5, 1 ], - "sleeveIndex" : [ 5, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 0, 1 ] - }, - { - "name" : "walk-6", - "index" : 13, - "bodyIndex" : [ 6, 1 ], - "sleeveIndex" : [ 6, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 2 ], - "hairOffset" : [ 0, 2 ] - }, - { - "name" : "walk-7", - "index" : 14, - "bodyIndex" : [ 7, 1 ], - "sleeveIndex" : [ 5, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 0, 1 ] - }, - { - "name" : "walk-8", - "index" : 15, - "bodyIndex" : [ 8, 1 ], - "sleeveIndex" : [ 4, 1 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 0, 0 ] - }, - { - "name" : "run-1", - "index" : 16, - "bodyIndex" : [ 1, 2 ], - "sleeveIndex" : [ 3, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 0 ] - }, - { - "name" : "run-2", - "index" : 17, - "bodyIndex" : [ 2, 2 ], - "sleeveIndex" : [ 2, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 1, -1 ] - }, - { - "name" : "run-3", - "index" : 18, - "bodyIndex" : [ 3, 2 ], - "sleeveIndex" : [ 3, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 0 ] - }, - { - "name" : "run-4", - "index" : 19, - "bodyIndex" : [ 4, 2 ], - "sleeveIndex" : [ 4, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 1, 1 ] - }, - { - "name" : "run-5", - "index" : 20, - "bodyIndex" : [ 5, 2 ], - "sleeveIndex" : [ 5, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 0 ] - }, - { - "name" : "run-6", - "index" : 21, - "bodyIndex" : [ 6, 2 ], - "sleeveIndex" : [ 6, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 1, -1 ] - }, - { - "name" : "run-7", - "index" : 22, - "bodyIndex" : [ 7, 2 ], - "sleeveIndex" : [ 5, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 0 ] - }, - { - "name" : "run-8", - "index" : 23, - "bodyIndex" : [ 8, 2 ], - "sleeveIndex" : [ 4, 2 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 2 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 1, 1 ] - }, - { - "name" : "jump-1", - "index" : 24, - "bodyIndex" : [ 1, 3 ], - "sleeveIndex" : [ 1, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "jump-2", - "index" : 25, - "bodyIndex" : [ 2, 3 ], - "sleeveIndex" : [ 2, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "jump-3", - "index" : 26, - "bodyIndex" : [ 3, 3 ], - "sleeveIndex" : [ 3, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "jump-4", - "index" : 27, - "bodyIndex" : [ 4, 3 ], - "sleeveIndex" : [ 4, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "fall-1", - "index" : 28, - "bodyIndex" : [ 5, 3 ], - "sleeveIndex" : [ 5, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "fall-2", - "index" : 29, - "bodyIndex" : [ 6, 3 ], - "sleeveIndex" : [ 6, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "fall-3", - "index" : 30, - "bodyIndex" : [ 7, 3 ], - "sleeveIndex" : [ 7, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "fall-4", - "index" : 31, - "bodyIndex" : [ 8, 3 ], - "sleeveIndex" : [ 8, 3 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 0 ], - "chestOffset" : [ 0, -1 ], - "hairOffset" : [ 0, -1 ] - }, - { - "name" : "swim-idle", - "index" : 32, - "bodyIndex" : [ 1, 5 ], - "sleeveIndex" : [ 1, 5 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 5 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 0 ] - }, - { - "name" : "swim-1", - "index" : 33, - "bodyIndex" : [ 4, 5 ], - "sleeveIndex" : [ 4, 5 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 5 ], - "chestOffset" : [ 0, 0 ], - "hairOffset" : [ 1, 0 ] - }, - { - "name" : "swim-2", - "index" : 34, - "bodyIndex" : [ 5, 5 ], - "sleeveIndex" : [ 5, 5 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 5 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 1, 1 ] - }, - { - "name" : "swim-3", - "index" : 35, - "bodyIndex" : [ 6, 5 ], - "sleeveIndex" : [ 6, 5 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 5 ], - "chestOffset" : [ 0, 2 ], - "hairOffset" : [ 1, 2 ] - }, - { - "name" : "swim-4", - "index" : 36, - "bodyIndex" : [ 7, 5 ], - "sleeveIndex" : [ 7, 5 ], - "sleeveOffset" : [ 0, 0 ], - "chestIndex" : [ 1, 5 ], - "chestOffset" : [ 0, 1 ], - "hairOffset" : [ 1, 1 ] - } - ] -} \ No newline at end of file + "poses": [ + { + "name": "personality-1", + "index": 1, + "bodyIndex": [1, 0], + "sleeveIndex": [1, 0], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 0], + "hairOffset": [0, 0] + }, + { + "name": "personality-2", + "index": 2, + "bodyIndex": [2, 0], + "sleeveIndex": [2, 0], + "sleeveOffset": [0, 0], + "chestIndex": [0, 1], + "chestOffset": [0, 0], + "hairOffset": [-1, 0] + }, + { + "name": "personality-3", + "index": 3, + "bodyIndex": [3, 0], + "sleeveIndex": [3, 0], + "sleeveOffset": [0, 0], + "chestIndex": [1, 1], + "chestOffset": [0, 0], + "hairOffset": [-1, 0] + }, + { + "name": "personality-4", + "index": 4, + "bodyIndex": [4, 0], + "sleeveIndex": [4, 0], + "sleeveOffset": [0, 0], + "chestIndex": [0, 1], + "chestOffset": [0, 0], + "hairOffset": [-1, 0] + }, + { + "name": "personality-5", + "index": 5, + "bodyIndex": [5, 0], + "sleeveIndex": [5, 0], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 0], + "hairOffset": [0, 0] + }, + { + "name": "sitting", + "index": 6, + "bodyIndex": [6, 0], + "sleeveIndex": [1, 0], + "sleeveOffset": [0, 1], + "chestIndex": [1, 0], + "chestOffset": [0, 1], + "hairOffset": [0, 1] + }, + { + "name": "ducking", + "index": 7, + "bodyIndex": [8, 0], + "sleeveIndex": [8, 0], + "sleeveOffset": [0, 0], + "chestIndex": [1, 3], + "chestOffset": [0, 0], + "hairOffset": [1, 8] + }, + { + "name": "walk-1", + "index": 8, + "bodyIndex": [1, 1], + "sleeveIndex": [3, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 1], + "hairOffset": [0, 1] + }, + { + "name": "walk-2", + "index": 9, + "bodyIndex": [2, 1], + "sleeveIndex": [2, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 2], + "hairOffset": [0, 2] + }, + { + "name": "walk-3", + "index": 10, + "bodyIndex": [3, 1], + "sleeveIndex": [3, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 1], + "hairOffset": [0, 1] + }, + { + "name": "walk-4", + "index": 11, + "bodyIndex": [4, 1], + "sleeveIndex": [4, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 0], + "hairOffset": [0, 0] + }, + { + "name": "walk-5", + "index": 12, + "bodyIndex": [5, 1], + "sleeveIndex": [5, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 1], + "hairOffset": [0, 1] + }, + { + "name": "walk-6", + "index": 13, + "bodyIndex": [6, 1], + "sleeveIndex": [6, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 2], + "hairOffset": [0, 2] + }, + { + "name": "walk-7", + "index": 14, + "bodyIndex": [7, 1], + "sleeveIndex": [5, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 1], + "hairOffset": [0, 1] + }, + { + "name": "walk-8", + "index": 15, + "bodyIndex": [8, 1], + "sleeveIndex": [4, 1], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, 0], + "hairOffset": [0, 0] + }, + { + "name": "run-1", + "index": 16, + "bodyIndex": [1, 2], + "sleeveIndex": [3, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, 0], + "hairOffset": [1, 0] + }, + { + "name": "run-2", + "index": 17, + "bodyIndex": [2, 2], + "sleeveIndex": [2, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, -1], + "hairOffset": [1, -1] + }, + { + "name": "run-3", + "index": 18, + "bodyIndex": [3, 2], + "sleeveIndex": [3, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, 0], + "hairOffset": [1, 0] + }, + { + "name": "run-4", + "index": 19, + "bodyIndex": [4, 2], + "sleeveIndex": [4, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, 1], + "hairOffset": [1, 1] + }, + { + "name": "run-5", + "index": 20, + "bodyIndex": [5, 2], + "sleeveIndex": [5, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, 0], + "hairOffset": [1, 0] + }, + { + "name": "run-6", + "index": 21, + "bodyIndex": [6, 2], + "sleeveIndex": [6, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, -1], + "hairOffset": [1, -1] + }, + { + "name": "run-7", + "index": 22, + "bodyIndex": [7, 2], + "sleeveIndex": [5, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, 0], + "hairOffset": [1, 0] + }, + { + "name": "run-8", + "index": 23, + "bodyIndex": [8, 2], + "sleeveIndex": [4, 2], + "sleeveOffset": [0, 0], + "chestIndex": [1, 2], + "chestOffset": [0, 1], + "hairOffset": [1, 1] + }, + { + "name": "jump-1", + "index": 24, + "bodyIndex": [1, 3], + "sleeveIndex": [1, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "jump-2", + "index": 25, + "bodyIndex": [2, 3], + "sleeveIndex": [2, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "jump-3", + "index": 26, + "bodyIndex": [3, 3], + "sleeveIndex": [3, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "jump-4", + "index": 27, + "bodyIndex": [4, 3], + "sleeveIndex": [4, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "fall-1", + "index": 28, + "bodyIndex": [5, 3], + "sleeveIndex": [5, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "fall-2", + "index": 29, + "bodyIndex": [6, 3], + "sleeveIndex": [6, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "fall-3", + "index": 30, + "bodyIndex": [7, 3], + "sleeveIndex": [7, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "fall-4", + "index": 31, + "bodyIndex": [8, 3], + "sleeveIndex": [8, 3], + "sleeveOffset": [0, 0], + "chestIndex": [1, 0], + "chestOffset": [0, -1], + "hairOffset": [0, -1] + }, + { + "name": "swim-idle", + "index": 32, + "bodyIndex": [1, 5], + "sleeveIndex": [1, 5], + "sleeveOffset": [0, 0], + "chestIndex": [1, 5], + "chestOffset": [0, 0], + "hairOffset": [1, 0] + }, + { + "name": "swim-1", + "index": 33, + "bodyIndex": [4, 5], + "sleeveIndex": [4, 5], + "sleeveOffset": [0, 0], + "chestIndex": [1, 5], + "chestOffset": [0, 0], + "hairOffset": [1, 0] + }, + { + "name": "swim-2", + "index": 34, + "bodyIndex": [5, 5], + "sleeveIndex": [5, 5], + "sleeveOffset": [0, 0], + "chestIndex": [1, 5], + "chestOffset": [0, 1], + "hairOffset": [1, 1] + }, + { + "name": "swim-3", + "index": 35, + "bodyIndex": [6, 5], + "sleeveIndex": [6, 5], + "sleeveOffset": [0, 0], + "chestIndex": [1, 5], + "chestOffset": [0, 2], + "hairOffset": [1, 2] + }, + { + "name": "swim-4", + "index": 36, + "bodyIndex": [7, 5], + "sleeveIndex": [7, 5], + "sleeveOffset": [0, 0], + "chestIndex": [1, 5], + "chestOffset": [0, 1], + "hairOffset": [1, 1] + } + ] +} diff --git a/webchargen.css b/webchargen.css index 7d8e023..34700fd 100644 --- a/webchargen.css +++ b/webchargen.css @@ -1,380 +1,323 @@ -* -{ - /*outline: 1px solid gray;*/ +/* GENERIC */ +body { + background-color: #121212; + overflow: hidden; + font-family: '04b03'; + user-select: none; } -/* GENERIC */ - body - { - background-color: #121212; - overflow: hidden; - font-family: '04b03'; - } - - * - { - -moz-user-select: -moz-none; - } - - #canvas-container - { - display: none; - } - - #pos-container - { - position: fixed; - top: 50%; - left: 50%; - margin-top: -236px; - margin-left: -236px; - height: 472px; - width: 472px; - } - - - #main-container - { - background-image: url(images/charactercreation.png); - height: 472px; - width: 472px; - position: relative; - } +#canvas-container { + display: none; +} + +#pos-container { + position: fixed; + top: 50%; + left: 50%; + margin-top: -236px; + margin-left: -236px; + height: 472px; + width: 472px; +} + +#main-container { + background-image: url(images/charactercreation.png); + height: 472px; + width: 472px; + position: relative; +} /* BUTTONS */ - .button:hover - { - cursor: pointer; - } - - .big-button - { - cursor: pointer; - padding: 0; - height: 58px; - width: 60px; - background-image: url(images/button.png); - display: inline-block; - margin-top: -11px; - margin-left: -16px; - margin-right: -4px; - background-position: -5px -5px; - background-repeat: no-repeat; - margin-bottom: 5px; - } - - .big-button:hover - { - background-position: -5px -63px; - } - - .big-button:active - { - } - - .big-button.selected - { - margin-top: -15px; - margin-left: -20px; - margin-right: 0px; - background-position: 0px -116px; - } - - .big-button.selected>div - { - margin-left: 4px; - margin-top: 4px; - } - - .big-button.selected:hover - { - background-position: 0px -174px; - } - - #save-button - { - position: absolute; - width: 172px; - height: 28px; - - background-image: url(images/createcharacter.png); - - margin-left: -86px; - left: 50%; - top: 432px; - } - - #save-button:hover - { - background-position: 0px -28px; - } - - +.button:hover { + cursor: pointer; +} + +.big-button { + cursor: pointer; + padding: 0; + height: 58px; + width: 60px; + background-image: url(images/button.png); + display: inline-block; + margin-top: -11px; + margin-left: -16px; + margin-right: -4px; + background-position: -5px -5px; + background-repeat: no-repeat; + margin-bottom: 5px; +} + +.big-button:hover { + background-position: -5px -63px; +} + +.big-button:active { +} + +.big-button.selected { + margin-top: -15px; + margin-left: -20px; + margin-right: 0px; + background-position: 0px -116px; +} + +.big-button.selected > div { + margin-left: 4px; + margin-top: 4px; +} + +.big-button.selected:hover { + background-position: 0px -174px; +} + +#save-button { + position: absolute; + width: 172px; + height: 28px; + + background-image: url(images/createcharacter.png); + + margin-left: -86px; + left: 50%; + top: 432px; +} + +#save-button:hover { + background-position: 0px -28px; +} + /* SPECIES BOX */ - #species-select-container - { - position: absolute; - top: 91px; - left: 53px; - width: 200px; - } - - #species-select-container > .species-selection > div - { - display: inline-block; - width: 50px; - height: 48px; - background-image: url(images/speciesPortrait.png); - background-repeat: no-repeat; - } - - #species-select-container > #species-human > div - { - background-position: 0px 0px; - } - - #species-select-container > #species-avian > div - { - background-position: -50px 0px; - } - - #species-select-container > #species-apex > div - { - background-position: -100px 0px; - } - - #species-select-container > #species-floran > div - { - background-position: 0px -48px; - } - - #species-select-container > #species-hylotl > div - { - background-position: -50px -48px; - } - - #species-select-container > #species-robot > div - { - background-position: -100px -48px; - } - - #species-select-container > #species-novakid > div - { - background-position: 0px -96px; - } - +#species-select-container { + position: absolute; + top: 91px; + left: 53px; + width: 200px; +} + +#species-select-container > .species-selection > div { + display: inline-block; + width: 50px; + height: 48px; + background-image: url(images/speciesPortrait.png); + background-repeat: no-repeat; +} + +#species-select-container > #species-human > div { + background-position: 0px 0px; +} + +#species-select-container > #species-avian > div { + background-position: -50px 0px; +} + +#species-select-container > #species-apex > div { + background-position: -100px 0px; +} + +#species-select-container > #species-floran > div { + background-position: 0px -48px; +} + +#species-select-container > #species-hylotl > div { + background-position: -50px -48px; +} + +#species-select-container > #species-glitch > div { + background-position: -100px -48px; +} + +#species-select-container > #species-novakid > div { + background-position: 0px -96px; +} + /* GENDER BOX */ - #gender-select-container { - position: absolute; - top: 203px; - left: 92px; - } - - #gender-select-container .big-button { - margin-right: 0px; - } - - #gender-select-container .big-button.selected { - margin-right: 4px; - } - - #gender-select-container > .gender-selection > div - { - width: 50px; - height: 48px; - display: inline-block; - background-image: url(images/genderIcons.png); - background-repeat: no-repeat; - background-position: 0px 0px; - } - - #gender-select-container > #gender-female.gender-selection > div - { - background-position: -50px 0px; - } - - #gender-male.selected > div, #gender-female.selected > div - { - margin-left: 4px; - margin-top: 4px; - } +#gender-select-container { + position: absolute; + top: 203px; + left: 92px; +} + +#gender-select-container .big-button { + margin-right: 0px; +} + +#gender-select-container .big-button.selected { + margin-right: 4px; +} + +#gender-select-container > .gender-selection > div { + width: 50px; + height: 48px; + display: inline-block; + background-image: url(images/genderIcons.png); + background-repeat: no-repeat; + background-position: 0px 0px; +} + +#gender-select-container > #gender-female.gender-selection > div { + background-position: -50px 0px; +} + +#gender-male.selected > div, +#gender-female.selected > div { + margin-left: 4px; + margin-top: 4px; +} /* RANDOMIZE BUTTON */ - #button-randomize-look - { - position: absolute; - cursor: pointer; - height: 36px; - width: 38px; - top: 207px; - right: 68px; - } - - .dice - { - background-image: url(images/dice.png); - background-repeat: no-repeat; - } - - .dice:hover - { - background-position: 0px -36px; - } +#button-randomize-look { + position: absolute; + cursor: pointer; + height: 36px; + width: 38px; + top: 207px; + right: 68px; +} + +.dice { + background-image: url(images/dice.png); + background-repeat: no-repeat; +} + +.dice:hover { + background-position: 0px -36px; +} /* CANVAS */ - #character-preview - { - position: absolute; - right: 72px; - top: 75px; - } +#character-preview { + position: absolute; + right: 72px; + top: 75px; +} /* OPTIONS BOX */ - #character-options-container - { - position: absolute; - left: 35px; - top: 256px; - width: 400px; - height: 100px; - } - - .option - { - margin-bottom: 6px; - height: 18px; - width: 195px; - display: inline-block; - white-space: nowrap; - font-size: 0px; - } - - .label - { - display: inline-block; - width: 135px; - height: 18px; - background-position: center; - background-repeat: no-repeat; - } - - #variable-helmetOption - { - display: none; - } - - .option-buttons - { - display: inline-block; - } - - .left-button, .right-button - { - display: inline-block; - height: 18px; - width: 16px; - background-image: url(images/pickButtons.png); - background-repeat: no-repeat; - background-position: 0px 0px; - } - - .left-button - { - } - - .left-button:hover - { - background-position: 0px -18px; - } - - .right-button - { - background-position: -16px 0px; - } - - .right-button:hover - { - background-position: -16px -18px; - } - - .option-counter - { - margin: 0px 3px; - display: inline-block; - } - - .option-counter div - { - display: inline-block; - width: 8px; - height: 18px; - margin: 0px 1px; - background-image: url(images/text/numbers.png); - background-repeat: no-repeat; - background-position: 0px 0px; - } - +#character-options-container { + position: absolute; + left: 35px; + top: 256px; + width: 400px; + height: 100px; +} + +.option { + margin-bottom: 6px; + height: 18px; + width: 195px; + display: inline-block; + white-space: nowrap; + font-size: 0px; +} + +.label { + display: inline-block; + width: 135px; + height: 18px; + background-position: center; + background-repeat: no-repeat; +} + +#variable-helmetOption { + display: none; +} + +.option-buttons { + display: inline-block; +} + +.left-button, +.right-button { + display: inline-block; + height: 18px; + width: 16px; + background-image: url(images/pickButtons.png); + background-repeat: no-repeat; + background-position: 0px 0px; +} + +.left-button:hover { + background-position: 0px -18px; +} + +.right-button { + background-position: -16px 0px; +} + +.right-button:hover { + background-position: -16px -18px; +} + +.option-counter { + margin: 0px 3px; + display: inline-block; +} + +.option-counter div { + display: inline-block; + width: 8px; + height: 18px; + margin: 0px 1px; + background-image: url(images/text/numbers.png); + background-repeat: no-repeat; + background-position: 0px 0px; +} + /* NAME LABEL */ - #nameLabel - { - position: absolute; - top: 389px; - left: 85px; - background-image: url(images/nameLabel.png); - background-repeat: no-repeat; - background-position: 0px 0px; - width: 302px; - height: 22px; - } - - #nameInput - { - position: absolute; - left: 50px; - top: 0px; - width: 244px; - height: 16px; - background-color: transparent; - border: none; - border: 2px solid #939393; - border-radius: 0px; - - color: white; - font-family: '04b03'; - font-size: 18px; - padding: 1px 2px; - } - - #nameInput:active, #nameInput:focus - { - border: 2px solid #ddd; - outline: none; - } +#nameLabel { + position: absolute; + top: 389px; + left: 85px; + background-image: url(images/nameLabel.png); + background-repeat: no-repeat; + background-position: 0px 0px; + width: 302px; + height: 22px; +} + +#nameInput { + position: absolute; + left: 50px; + top: 0px; + width: 244px; + height: 16px; + background-color: transparent; + border: none; + border: 2px solid #939393; + border-radius: 0px; + + color: white; + font-family: '04b03'; + font-size: 18px; + padding: 1px 2px; +} + +#nameInput:active, +#nameInput:focus { + border: 2px solid #ddd; + outline: none; +} /* LOADING SCREEN */ - #loading-screen - { - top: 0px; - left: 0px; - width: 100%; - height: 100%; - position: absolute; - z-index: 1000; - background-color: #121212; - opacity: 0.8; - overflow: hidden; - } - - #loading-text - { - width: 300px; - height: 30px; - position: fixed; - top: 50%; - left: 50%; - margin-left: -150px; - margin-top: -15px; - text-align: center; - font-size: 30px; - color: white; - } \ No newline at end of file +#loading-screen { + top: 0px; + left: 0px; + width: 100%; + height: 100%; + position: absolute; + z-index: 1000; + background-color: #121212; + opacity: 0.8; + overflow: hidden; +} + +#loading-text { + width: 300px; + height: 30px; + position: fixed; + top: 50%; + left: 50%; + margin-left: -150px; + margin-top: -15px; + text-align: center; + font-size: 30px; + color: white; +} diff --git a/webchargen.js b/webchargen.js deleted file mode 100644 index 4b14964..0000000 --- a/webchargen.js +++ /dev/null @@ -1,441 +0,0 @@ -"use strict"; - -var config; - -var painter; -var currentSettings; - -var imageInfo = {}; -var itemsToLoad = 0, itemsLoaded = 0; -var percentLoaded = 0.0; - -var fadeDelay = 200; -var fadeStyle = "fast"; -var loopID; - -var warpFrames = 16; -var warpCurrentFrame = 0; -var warpInterval = 50; - -// Hook up our onload and schnitzel-witzel -$( function () - { - currentSettings = new Settings(); - currentSettings.updateCounters(); - - $.getJSON( 'webchargen.config.json', function ( data ) - { - console.log( "Got JSON" ); - - $.when( loadData( data, true ) ).then( function () - { - painter = new Painter( document.getElementById( "character-preview" ) ); - - currentSettings.recalc( config ); - console.log( "Loop started" ); - loopID = window.setInterval( loadingLoop, 10 ); - preLoad(); - } - ); - } - ); - - // Click ALL the buttons! - $(".big-button").click(function () { - clickyDeselection(); - bigButtonClick( this ); - }); - - $(".button").click(function() { - clickyDeselection(); - littleButtonClick( this ); - }); - - $("#button-randomize-look").click( function() { - clickyDeselection(); - randomizeButtonClick(); - }); - - $("#save-button").click( function() { - saveImage(); - }); - - $("#nameInput").keyup( function( event ) { - if ( event.which == 13 ) - { - event.preventDefault(); - checkName(); - } - }); - - $("#nameInput").blur( function() { - checkName(); - }); - - // Disables text selection of our pretty images in... some browser. I don't remember. - // I saw it on the internet, so it has to be true. - document.onselectstart = function() { return false; } - } -); - -// After fetching our config file, set some basics up -function loadData( data ) -{ - config = data; - console.log( "Loaded data with " + Object.size( config ) + " root nodes" ); - - /* - setOptionText(); - - for (var v = 5; v <= 8; v++) { - $("#variable-" + v).find(".label").css( - { "background-image" : "url(images/text/" + config.sharedOptions[v - 5] + ".png)"} - ); - } - */ - - $("#species-" + currentSettings.species).addClass("selected"); - $("#gender-" + currentSettings.gender).addClass("selected"); - - console.log( "Hi mom" ); -} - -// Prefetch all our images. ALL OF ZEM. -function preLoad() -{ - for ( var t in config.sharedOptions ) - { - var textImg = new Image(); - textImg.src = "images/text/" + config.sharedOptions[t] + ".png"; - textImg.onload = function() { incPercentLoaded(); } - imageInfo["text-" + config.sharedOptions[t]] = textImg; - - itemsToLoad++; - } - - for ( var r in config.species ) - { - if ( r.charAt(0) == '_' ) - continue; - - // Prefetch male body sheet - var bodyMaleImg = new Image(); - bodyMaleImg.src = "images/sheets/" + r + "/body-male.png"; - bodyMaleImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-body-male"] = bodyMaleImg; - - // Prefetch female body sheet - var bodyFemaleImg = new Image(); - bodyFemaleImg.src = "images/sheets/" + r + "/body-female.png"; - bodyFemaleImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-body-female"] = bodyFemaleImg; - - // Prefetch front arm sheet - var bodyfrontArmImg = new Image(); - bodyfrontArmImg.src = "images/sheets/" + r + "/body-frontArm.png"; - bodyfrontArmImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-body-frontArm"] = bodyfrontArmImg; - - // Prefetch back arm sheet - var bodybackArmImg = new Image(); - bodybackArmImg.src = "images/sheets/" + r + "/body-backArm.png"; - bodybackArmImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-body-backArm"] = bodybackArmImg; - - // Prefetch accessory (hair) sheet - var bodyMaleImg = new Image(); - bodyMaleImg.src = "images/sheets/" + r + "/body-accessories.png"; - bodyMaleImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-body-accessory"] = bodyMaleImg; - - itemsToLoad += 5; - - for ( var t in config.species[r].variables.names ) - { - var labelName = config.species[r].variables.names[t]; - if ( imageInfo["text-" + labelName] != null ) - continue; - - var textImg = new Image(); - textImg.src = "images/text/" + labelName + ".png"; - textImg.onload = function() { incPercentLoaded(); } - imageInfo["text-" + labelName] = textImg; - - itemsToLoad++; - } - - for ( var a in config.species[r].armors.names ) - { - var aName = config.species[r].armors.names[a]; - if ( aName === null ) - continue; - - // Load male chest sheet - var armorMaleChestImg = new Image(); - armorMaleChestImg.src = "images/sheets/" + r + "/armor-" + aName + "-chestMale.png"; - armorMaleChestImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-armor-" + aName + "-maleChest"] = armorMaleChestImg; - - // Load female chest sheet - var armorFemaleChestImg = new Image(); - armorFemaleChestImg.src = "images/sheets/" + r + "/armor-" + aName + "-chestFemale.png"; - armorFemaleChestImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-armor-" + aName + "-femaleChest"] = armorFemaleChestImg; - - // Load male pants sheet - var armorMalePantsImg = new Image(); - armorMalePantsImg.src = "images/sheets/" + r + "/armor-" + aName + "-pantsMale.png"; - armorMalePantsImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-armor-" + aName + "-malePants"] = armorMalePantsImg; - - // Load female pants sheet - var armorFemalePantsImg = new Image(); - armorFemalePantsImg.src = "images/sheets/" + r + "/armor-" + aName + "-pantsFemale.png"; - armorFemalePantsImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-armor-" + aName + "-femalePants"] = armorFemalePantsImg; - - // Load front sleeve sheet - var armorFrontSleeveImg = new Image(); - armorFrontSleeveImg.src = "images/sheets/" + r + "/armor-" + aName + "-frontSleeve.png"; - armorFrontSleeveImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-armor-" + aName + "-frontSleeve"] = armorFrontSleeveImg; - - // Load back sleeve sheet - var armorBackSleeveImg = new Image(); - armorBackSleeveImg.src = "images/sheets/" + r + "/armor-" + aName + "-backSleeve.png"; - armorBackSleeveImg.onload = function() { incPercentLoaded(); } - imageInfo[r + "-armor-" + aName + "-backSleeve"] = armorBackSleeveImg; - - itemsToLoad += 5; - } - - } - - // Load warp-in - var warpImg = new Image(); - warpImg.src = "images/playerWarpIn.png"; - warpImg.onload = function() { incPercentLoaded(); } - imageInfo["warpIn"] = warpImg; - - itemsToLoad++; -} - -// Use entire function to increment one number. Like a boss. -function incPercentLoaded() -{ - itemsLoaded++; -} - -// Poll our completion status, make everything ready once we're all set -function loadingLoop() -{ - var percentLoaded = ( itemsLoaded / itemsToLoad ) * 100; - - if (percentLoaded < 100 ) - { - $("#loading-text").html( "Loading...
" + percentLoaded.toFixed(4) + "%" ); - } - else - { - console.log( "Image prefetch loop stopped." ); - window.clearInterval( loopID ); - $("#loading-text").html( "Loading...
Done!" ); - - setOptionText(); - //painter.repaint( config, currentSettings, imageInfo ); - - $.when( $("#loading-screen").delay( fadeDelay ).fadeOut( fadeStyle ) ).then( function() { loopID = window.setInterval( playWarp, warpInterval ) } ); - } -} - -function playWarp() -{ - painter.CONTEXT.clearRect( 0, 0, painter.SPRITE_SIZE * painter.PREVIEW_MULTI, painter.SPRITE_SIZE * painter.PREVIEW_MULTI ); - - if ( warpCurrentFrame == warpFrames - 1 ) - painter.repaint( config, currentSettings, imageInfo ); - - painter.paintToCanvas( imageInfo["warpIn"], warpCurrentFrame, 0, 0, 0, null, painter.bodyCanvas ); - warpCurrentFrame++; - - if ( warpCurrentFrame == warpFrames ) - { - window.clearInterval( loopID ); - painter.repaint( config, currentSettings, imageInfo ); - } -} - -// Tell the users what all those cute little buttons do. Otherwise they get cranky. -// The users, that is. Not the buttons. -// I assume. -function setOptionText() -{ - $("#character-options-container").children().each( function( index ) - { - var variableName; - if ( index < 4 ) - variableName = config.species[currentSettings.species].variables.names[index]; - else - variableName = config.sharedOptions[index-4]; - - //console.log( "Setting option " + index + " to " + variableName ); - $(this).children(".label").css( { "background-image" : "url(images/text/" + variableName + ".png)" } ); - } - ); -} - -// The measure of a man is in how quickly he can click on small buttons on a computer monitor. -// If he were to click too quickly, he would have selected a fraction of the page. -// Knock that off, man. -function clickyDeselection() -{ - // Strong enough for a man. Gentle enough for a woman. - if ( window.getSelection ) - { - if ( window.getSelection().empty ) // Chrome - window.getSelection().empty(); - else if ( window.getSelection().removeAllRanges ) // Firefox - window.getSelection().removeAllRanges(); - } - else if (document.selection) // "Misc" - { - document.selection.empty(); - } -} - -// Them button what be big. When user clicks this, big things be happening. -function bigButtonClick( obj ) -{ - if ( $(obj).hasClass( "disabled" ) ) - { - return true; - } - - console.log( "Clicked big button" ); - - // User wants to be another species. Weirdo. - if ( $(obj).hasClass( "species-selection" ) ) - { - var speciesName = obj.id.substring( 8 ); - - console.log( "Changing to species " + speciesName ); - - // First of all we need to check for armor special options and preserve those, since they can vary between species - var shirtArmorName = config.species[currentSettings.species].armors.names[currentSettings.shirtOption]; - var pantsArmorName = config.species[currentSettings.species].armors.names[currentSettings.pantsOption]; - - currentSettings.species = speciesName; - currentSettings.reset( true ); - - if ( shirtArmorName == "extra" || shirtArmorName == null ) - currentSettings.shirtOption = config.species[currentSettings.species].armors.names.indexOf( shirtArmorName ); - - if ( pantsArmorName == "extra" || pantsArmorName == null ) - currentSettings.pantsOption = config.species[currentSettings.species].armors.names.indexOf( pantsArmorName ); - - // Make sure we show the right gender button icons - var iconOffset = config.species[currentSettings.species].variables.genders.iconOffset * 48; - $("#gender-male").children().css( "backgroundPosition", "0px -" + iconOffset + "px" ); - $("#gender-female").children().css( "backgroundPosition", "-50px -" + iconOffset + "px" ); - } - else // And now they want to be another gender. Who do they think they are, some kind of pixel sized Tiresias? - { - var genderName = obj.id.substring( 7 ); - - console.log( "Changing to gender " + genderName ); - currentSettings.gender = genderName; - currentSettings.reset( false ); - } - - // Highlightificationcoulrophobiaafearofstilts - $(".species-selection").removeClass( "selected" ); - $(".gender-selection").removeClass( "selected" ); - - $("#species-" + currentSettings.species).addClass("selected"); - $("#gender-" + currentSettings.gender).addClass("selected"); - setOptionText(); - - currentSettings.recalc( config ); - currentSettings.updateCounters(); - painter.repaint( config, currentSettings, imageInfo ); -} - -// Big button's younger brother. He dreams of one day growing up to become the biggest, most buttonest kid on the playground. An iPad interface. -function littleButtonClick( obj ) -{ - console.log( "Clicked widdle button" ); - - var optionName = obj.parentNode.parentNode.id.substring( 9 ); - console.log( "Changing option " + optionName ); - - var optionMax = currentSettings[optionName + "Max"]; - - if ( $(obj).hasClass( "left-button" ) ) - { - console.log( "Clicked option " + optionName + " going backwards at " + currentSettings[optionName] + " with max " + optionMax ); - - currentSettings[optionName] -= 1; - if ( currentSettings[optionName] < 0 ) - currentSettings[optionName] = optionMax - 1; - } - else - { - console.log( "Clicked option " + optionName + " going onwards(!) at " + currentSettings[optionName] + " with max " + optionMax ); - - currentSettings[optionName] += 1; - if ( currentSettings[optionName] >= optionMax ) - currentSettings[optionName] = 0; - } - - // Recalculate our options, update counters, then draw our sprite - currentSettings.recalc( config ); - currentSettings.updateCounters(); - painter.repaint( config, currentSettings, imageInfo ); -} - -// BREAK GLASS IN CASE OF MIDLIFE CRISIS -function randomizeButtonClick() -{ - currentSettings.randomize(); - - // Recalculate our options, update counters, then draw our sprite - currentSettings.recalc( config ); - currentSettings.updateCounters(); - painter.repaint( config, currentSettings, imageInfo ); -} - - -// Never before in history has so few lines made so many people sacrifice so much gray matter. -function saveImage() -{ - var img = document.getElementById( "character-preview" ).toDataURL( "image/png" ); - window.location.href = img.replace( "image/png", "image/octet-stream" ); -} - -function checkName() -{ - currentSettings.setName( $("#nameInput").val() ); -} - -// Since object is mathematically challenged, we have to help it along a bit. -Object.size = function(obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) size++; - } - return size; -}; - -// Brazenly stolen from SO -function toHash( string ) -{ - var hash = 17; - - for ( var i = 0; i < string.length; i++ ) - { - hash = ( ( hash << 5 ) - hash ) + string.charCodeAt( i ); - hash = hash & hash; // Convert to 32bit integer - } - - return hash.toString( 16 ); -} diff --git a/webchargen.mjs b/webchargen.mjs new file mode 100644 index 0000000..ba113f7 --- /dev/null +++ b/webchargen.mjs @@ -0,0 +1,461 @@ +/** + * @typedef {Object} ImageInfo + * @property {HTMLImageElement} [key: string] + */ + +import { Settings } from './settings.mjs'; +import { Painter } from './painter.mjs'; + +export class CharacterGenerator { + /** + * Configuration data + * @type {Object|null} + */ + config = null; + + /** + * Painter instance + * @type {Painter|null} + */ + painter = null; + + /** + * Current settings + * @type {Settings|null} + */ + currentSettings = null; + + /** + * Information about loaded images + * @type {ImageInfo} + */ + imageInfo = {}; + + /** + * Total number of items to load + * @type {number} + */ + itemsToLoad = 0; + + /** + * Number of items loaded + * @type {number} + */ + itemsLoaded = 0; + + /** + * Percentage of items loaded + * @type {number} + */ + percentLoaded = 0.0; + + /** + * Fade delay in milliseconds + * @type {number} + */ + fadeDelay = 200; + + /** + * Fade style + * @type {string} + */ + fadeStyle = 'fast'; + + /** + * ID of the loop interval + * @type {number|null} + */ + loopID = null; + + /** + * Number of warp frames + * @type {number} + */ + warpFrames = 16; + + /** + * Current warp frame + * @type {number} + */ + warpCurrentFrame = 0; + + /** + * Warp interval in milliseconds + * @type {number} + */ + warpInterval = 50; + + /** + * Initialization method + */ + init() { + this.currentSettings = new Settings(); + this.currentSettings.updateCounters(); + + fetch('webchargen.config.json') + .then((response) => response.json()) + .then((data) => { + console.log('Got JSON'); + return this.loadData(data, true); + }) + .then(() => { + this.painter = new Painter(document.getElementById('character-preview')); + + this.currentSettings.recalc(this.config); + console.log('Loop started'); + this.loopID = setInterval(() => this.loadingLoop(), 10); + this.preLoad(); + }) + .catch((error) => console.error(error)); + + document.querySelectorAll('.big-button').forEach((button) => { + button.addEventListener('click', () => { + this.clickyDeselection(); + this.bigButtonClick(button); + }); + }); + + document.querySelectorAll('.button').forEach((button) => { + button.addEventListener('click', () => { + this.clickyDeselection(); + this.littleButtonClick(button); + }); + }); + + document.getElementById('button-randomize-look').addEventListener('click', () => { + this.clickyDeselection(); + this.randomizeButtonClick(); + }); + + document.getElementById('save-button').addEventListener('click', () => { + this.saveImage(); + }); + + document.getElementById('nameInput').addEventListener('keyup', (event) => { + if (event.key === 'Enter') { + event.preventDefault(); + this.checkName(); + } + }); + + document.getElementById('nameInput').addEventListener('blur', () => { + this.checkName(); + }); + } + + /** + * Load configuration data + * @param {Object} data + */ + loadData(data) { + this.config = data; + console.log(`Loaded data with ${Object.keys(this.config).length} root nodes`); + + document.querySelector(`#species-${this.currentSettings.species}`).classList.add('selected'); + document.querySelector(`#gender-${this.currentSettings.gender}`).classList.add('selected'); + + console.log('Hi mom'); + } + + /** + * Preload images + */ + preLoad() { + for (let t in this.config.sharedOptions) { + let textImg = new Image(); + textImg.src = `images/text/${this.config.sharedOptions[t]}.png`; + textImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`text-${this.config.sharedOptions[t]}`] = textImg; + + this.itemsToLoad++; + } + + for (let r in this.config.species) { + if (r.charAt(0) == '_') continue; + + let headMaleImg = new Image(); + headMaleImg.src = `images/sheets/${r}/head-male.png`; + headMaleImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-head-male`] = headMaleImg; + + let headFemaleImg = new Image(); + headFemaleImg.src = `images/sheets/${r}/head-female.png`; + headFemaleImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-head-female`] = headFemaleImg; + + let bodyMaleImg = new Image(); + bodyMaleImg.src = `images/sheets/${r}/body-male.png`; + bodyMaleImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-body-male`] = bodyMaleImg; + + let bodyFemaleImg = new Image(); + bodyFemaleImg.src = `images/sheets/${r}/body-female.png`; + bodyFemaleImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-body-female`] = bodyFemaleImg; + + let bodyfrontArmImg = new Image(); + bodyfrontArmImg.src = `images/sheets/${r}/body-frontArm.png`; + bodyfrontArmImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-body-frontArm`] = bodyfrontArmImg; + + let bodybackArmImg = new Image(); + bodybackArmImg.src = `images/sheets/${r}/body-backArm.png`; + bodybackArmImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-body-backArm`] = bodybackArmImg; + + let bodyAccessoryImg = new Image(); + bodyAccessoryImg.src = `images/sheets/${r}/body-accessories.png`; + bodyAccessoryImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-body-accessory`] = bodyAccessoryImg; + + this.itemsToLoad += 5; + + for (let t in this.config.species[r].variables.names) { + let labelName = this.config.species[r].variables.names[t]; + if (this.imageInfo[`text-${labelName}`] != null) continue; + + let textImg = new Image(); + textImg.src = `images/text/${labelName}.png`; + textImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`text-${labelName}`] = textImg; + + this.itemsToLoad++; + } + + for (let a in this.config.species[r].armors.names) { + let aName = this.config.species[r].armors.names[a]; + if (aName === null) continue; + + let armorMaleChestImg = new Image(); + armorMaleChestImg.src = `images/sheets/${r}/armor-${aName}-chestMale.png`; + armorMaleChestImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-armor-${aName}-maleChest`] = armorMaleChestImg; + + let armorFemaleChestImg = new Image(); + armorFemaleChestImg.src = `images/sheets/${r}/armor-${aName}-chestFemale.png`; + armorFemaleChestImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-armor-${aName}-femaleChest`] = armorFemaleChestImg; + + let armorMalePantsImg = new Image(); + armorMalePantsImg.src = `images/sheets/${r}/armor-${aName}-pantsMale.png`; + armorMalePantsImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-armor-${aName}-malePants`] = armorMalePantsImg; + + let armorFemalePantsImg = new Image(); + armorFemalePantsImg.src = `images/sheets/${r}/armor-${aName}-pantsFemale.png`; + armorFemalePantsImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-armor-${aName}-femalePants`] = armorFemalePantsImg; + + let armorFrontSleeveImg = new Image(); + armorFrontSleeveImg.src = `images/sheets/${r}/armor-${aName}-frontSleeve.png`; + armorFrontSleeveImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-armor-${aName}-frontSleeve`] = armorFrontSleeveImg; + + let armorBackSleeveImg = new Image(); + armorBackSleeveImg.src = `images/sheets/${r}/armor-${aName}-backSleeve.png`; + armorBackSleeveImg.onload = () => this.incPercentLoaded(); + this.imageInfo[`${r}-armor-${aName}-backSleeve`] = armorBackSleeveImg; + + this.itemsToLoad += 5; + } + } + + let warpImg = new Image(); + warpImg.src = 'images/playerWarpIn.png'; + warpImg.onload = () => this.incPercentLoaded(); + this.imageInfo['warpIn'] = warpImg; + + this.itemsToLoad++; + } + + /** + * Increment the count of loaded items + */ + incPercentLoaded() { + this.itemsLoaded++; + this.updateLoadingText(); + } + + /** + * Update the loading text + */ + updateLoadingText() { + let percentLoaded = (this.itemsLoaded / this.itemsToLoad) * 100; + document.getElementById('loading-text').innerHTML = `Loading...
${percentLoaded.toFixed(4)}%`; + } + + /** + * Loading loop + */ + loadingLoop() { + let percentLoaded = (this.itemsLoaded / this.itemsToLoad) * 100; + + if (percentLoaded < 100) { + this.updateLoadingText(); + } else { + console.log('Image prefetch loop stopped.'); + clearInterval(this.loopID); + document.getElementById('loading-text').innerHTML = 'Loading...
Done!'; + + this.setOptionText(); + document.getElementById('loading-screen').style.display = 'none'; + this.loopID = setInterval(() => this.playWarp(), this.warpInterval); + } + } + + /** + * Play warp animation + */ + playWarp() { + this.painter.CONTEXT.clearRect( + 0, + 0, + this.painter.SPRITE_SIZE * this.painter.PREVIEW_MULTI, + this.painter.SPRITE_SIZE * this.painter.PREVIEW_MULTI + ); + + if (this.warpCurrentFrame == this.warpFrames - 1) this.painter.repaint(this.config, this.currentSettings, this.imageInfo); + + this.painter.paintToCanvas(this.imageInfo['warpIn'], this.warpCurrentFrame, 0, 0, 0); + this.warpCurrentFrame++; + + if (this.warpCurrentFrame == this.warpFrames) { + clearInterval(this.loopID); + this.painter.repaint(this.config, this.currentSettings, this.imageInfo); + } + } + + /** + * Set option text + */ + setOptionText() { + const container = document.getElementById('character-options-container'); + Array.from(container.children).forEach((child, index) => { + let variableName; + if (index < 4) { + variableName = this.config.species[this.currentSettings.species].variables.names[index]; + } else { + variableName = this.config.sharedOptions[index - 4]; + } + child.querySelector('.label').style.backgroundImage = `url(images/text/${variableName}.png)`; + }); + } + + /** + * Clear selection + */ + clickyDeselection() { + if (window.getSelection) { + if (window.getSelection().empty) window.getSelection().empty(); + else if (window.getSelection().removeAllRanges) window.getSelection().removeAllRanges(); + } else if (document.selection) { + document.selection.empty(); + } + } + + /** + * Handle big button click event + * @param {HTMLElement} obj + */ + bigButtonClick(obj) { + if (obj.classList.contains('disabled')) { + return true; + } + + console.log('Clicked big button'); + + if (obj.classList.contains('species-selection')) { + let speciesName = obj.id.substring(8); + + console.log('Changing to species ' + speciesName); + + let shirtArmorName = this.config.species[this.currentSettings.species].armors.names[this.currentSettings.shirtOption]; + let pantsArmorName = this.config.species[this.currentSettings.species].armors.names[this.currentSettings.pantsOption]; + + this.currentSettings.species = speciesName; + this.currentSettings.reset(true); + + if (shirtArmorName == 'extra' || shirtArmorName == null) + this.currentSettings.shirtOption = this.config.species[this.currentSettings.species].armors.names.indexOf(shirtArmorName); + + if (pantsArmorName == 'extra' || pantsArmorName == null) + this.currentSettings.pantsOption = this.config.species[this.currentSettings.species].armors.names.indexOf(pantsArmorName); + + let iconOffset = this.config.species[this.currentSettings.species].variables.genders.iconOffset * 48; + document.getElementById('gender-male').children[0].style.backgroundPosition = `0px -${iconOffset}px`; + document.getElementById('gender-female').children[0].style.backgroundPosition = `-50px -${iconOffset}px`; + } else { + let genderName = obj.id.substring(7); + + console.log('Changing to gender ' + genderName); + this.currentSettings.gender = genderName; + this.currentSettings.reset(false); + } + + document.querySelectorAll('.species-selection').forEach((el) => el.classList.remove('selected')); + document.querySelectorAll('.gender-selection').forEach((el) => el.classList.remove('selected')); + + document.getElementById(`species-${this.currentSettings.species}`).classList.add('selected'); + document.getElementById(`gender-${this.currentSettings.gender}`).classList.add('selected'); + this.setOptionText(); + + this.currentSettings.recalc(this.config); + this.currentSettings.updateCounters(); + this.painter.repaint(this.config, this.currentSettings, this.imageInfo); + } + + /** + * Handle little button click event + * @param {HTMLElement} obj + */ + littleButtonClick(obj) { + console.log('Clicked widdle button'); + + let optionName = obj.parentNode.parentNode.id.substring(9); + console.log('Changing option ' + optionName); + + let optionMax = this.currentSettings[optionName + 'Max']; + + if (obj.classList.contains('left-button')) { + console.log(`Clicked option ${optionName} going backwards at ${this.currentSettings[optionName]} with max ${optionMax}`); + + this.currentSettings[optionName] -= 1; + if (this.currentSettings[optionName] < 0) this.currentSettings[optionName] = optionMax - 1; + } else { + console.log(`Clicked option ${optionName} going onwards(!) at ${this.currentSettings[optionName]} with max ${optionMax}`); + + this.currentSettings[optionName] += 1; + if (this.currentSettings[optionName] >= optionMax) this.currentSettings[optionName] = 0; + } + + this.currentSettings.recalc(this.config); + this.currentSettings.updateCounters(); + this.painter.repaint(this.config, this.currentSettings, this.imageInfo); + } + + /** + * Handle randomize button click event + */ + randomizeButtonClick() { + this.currentSettings.randomize(); + + this.currentSettings.recalc(this.config); + this.currentSettings.updateCounters(); + this.painter.repaint(this.config, this.currentSettings, this.imageInfo); + } + + /** + * Save the generated image + */ + saveImage() { + let img = document.getElementById('character-preview').toDataURL('image/png'); + window.location.href = img.replace('image/png', 'image/octet-stream'); + } + + /** + * Check the entered name + */ + checkName() { + this.currentSettings.setName(document.getElementById('nameInput').value); + } +}