Browse Source

more work to wquery

tags/v0.3.0
Big Bad Waffle 5 years ago
parent
commit
d758a59199
10 changed files with 40 additions and 25 deletions
  1. +1
    -1
      src/client/css/main.less
  2. +1
    -1
      src/client/index.html
  3. +2
    -4
      src/client/js/components/inventory.js
  4. +1
    -1
      src/client/js/rendering/renderer.js
  5. +24
    -9
      src/client/plugins/wquery.js
  6. +3
    -3
      src/client/ui/templates/tooltipItem/tooltipItem.js
  7. +2
    -2
      src/client/ui/templates/wardrobe/wardrobe.js
  8. +1
    -1
      src/client/ui/templates/workbench/workbench.js
  9. +4
    -2
      src/server/components/extensions/socialCommands.js
  10. +1
    -1
      src/server/misc/mods.js

+ 1
- 1
src/client/css/main.less View File

@@ -35,7 +35,7 @@ body {
user-select: none;
}

.canvasContainer {
.canvas-container {
position: relative;
float: left;



+ 1
- 1
src/client/index.html View File

@@ -11,7 +11,7 @@
<link rel="icon" href="images/favicon.ico">
</head>
<body>
<div class="canvasContainer"></div>
<div class="canvas-container"></div>
<div class="ui-container">
<div class="right"></div>
</div>


+ 2
- 4
src/client/js/components/inventory.js View File

@@ -69,13 +69,11 @@ define([
if (item.level > stats.level)
errors.push('level');

if ((item.requires) && (stats[item.requires[0].stat] < item.requires[0].value))
if (item.requires && item.requires[0] && stats[item.requires[0].stat] < item.requires[0].value)
errors.push('stats');

if (item.factions) {
if (item.factions.some(function (f) {
return f.noEquip;
}))
if (item.factions.some(f => f.noEquip))
errors.push('faction');
}



+ 1
- 1
src/client/js/rendering/renderer.js View File

@@ -90,7 +90,7 @@ define([
window.onresize = this.onResize.bind(this);

$(this.renderer.view)
.appendTo('.canvasContainer');
.appendTo('.canvas-container');

this.stage = new pixi.Container();



+ 24
- 9
src/client/plugins/wquery.js View File

@@ -1,3 +1,5 @@
const sqData = new Map();

const sq = {
default: function (q) {
const type = typeof(q);
@@ -26,8 +28,11 @@ const sq = {
return sq.wrap(els);
},

children: function () {
return sq.wrap(this[0].children);
children: function (filter) {
if (!filter)
return sq.wrap(this[0].children);

return this.find(filter);
},

parent: function () {
@@ -96,7 +101,8 @@ const sq = {
},

addClass: function (classNames) {
classNames.split(' ').forEach(c => this.each(el => el.classList.add(c)));
if (classNames)
classNames.split(' ').forEach(c => this.each(el => el.classList.add(c)));
return this;
},

@@ -158,7 +164,13 @@ const sq = {
if (['left', 'top', 'width', 'height'].includes(c) && (!val.indexOf || val.indexOf('%') === -1))
val += 'px';

this.each(el => val ? el.attributeStyleMap.set(c, val) : el.attributeStyleMap.delete(c));
this.each(el => {
if (val)
el.style[c] = val;

else
el.attributeStyleMap.delete(c);
});
});
return this;
},
@@ -235,13 +247,16 @@ const sq = {
},

data: function (property, value) {
if (!this.dataSet)
this.dataSet = {};
let dataSet = sqData.get(this[0]);
if (!dataSet) {
dataSet = {};
sqData.set(this[0], dataSet);
}

if (arguments.length === 1)
return this.dataSet[property];
return dataSet[property];

this.dataSet[property] = value;
dataSet[property] = value;

return this;
},
@@ -316,7 +331,7 @@ const sq = {
return newO;
}

if (!newO)
if (!newO || typeof(newO) !== 'object')
newO = {};
for (let i in o) {
if (o.hasOwnProperty(i))


+ 3
- 3
src/client/ui/templates/tooltipItem/tooltipItem.js View File

@@ -247,7 +247,7 @@ define([
.replace('$STATS$', stats)
.replace('$LEVEL$', level);

if (item.requires) {
if (item.requires && item.requires[0]) {
html = html
.replace('$ATTRIBUTE$', item.requires[0].stat)
.replace('$ATTRIBUTEVALUE$', item.requires[0].value);
@@ -305,7 +305,7 @@ define([
} else
this.tooltip.find('.requires .stats').show();

if ((!item.stats) || (!Object.keys(item.stats).length))
if (!stats.length)
this.tooltip.children('.stats').hide();

if ((!item.type) || (item.type === item.name))
@@ -399,7 +399,7 @@ define([
} else
this.find('.faction').hide();

if ((shiftDown) || (!compare))
if (shiftDown || !compare)
this.tooltip.find('.info').hide();

if (item.cd) {


+ 2
- 2
src/client/ui/templates/wardrobe/wardrobe.js View File

@@ -58,13 +58,13 @@ define([
this.skin = skin;

let costume = skin.sprite.split(',');
let spirteX = -costume[0] * 8;
let spriteX = -costume[0] * 8;
let spriteY = -costume[1] * 8;

let spritesheet = skin.spritesheet || '../../../images/characters.png';

this.find('.sprite')
.css('background', 'url("' + spritesheet + '") ' + spirteX + 'px ' + spriteY + 'px');
.css('background', 'url("' + spritesheet + '") ' + spriteX + 'px ' + spriteY + 'px');
},

apply: function () {


+ 1
- 1
src/client/ui/templates/workbench/workbench.js View File

@@ -31,7 +31,7 @@ define([

onOpenWorkbench: function (msg) {
this.workbenchId = msg.workbenchId;
this.find('.heading-title').html(msg.name);
this.find('.heading-text').html(msg.name);

this.renderRecipes(msg.recipes);



+ 4
- 2
src/server/components/extensions/socialCommands.js View File

@@ -9,6 +9,7 @@ let commandRoles = {
join: 0,
leave: 0,
unEq: 0,
roll: 0,

//Mods
mute: 5,
@@ -34,7 +35,8 @@ let localCommands = [
'leave',
'mute',
'unmute',
'setPassword'
'setPassword',
'roll'
];

module.exports = {
@@ -196,7 +198,7 @@ module.exports = {

roll: function () {
let roll = 1 + ~~(Math.random() * 100);
global.io.sockets.emit('event', {
cons.emit('event', {
event: 'onGetMessages',
data: {
messages: [{


+ 1
- 1
src/server/misc/mods.js View File

@@ -10,7 +10,7 @@ module.exports = {

modList.forEach(function (m) {
let mod = require('../mods/' + m + '/index');
//this.onGetMod(m, mod);
this.onGetMod(m, mod);
}, this);

cbDone();


Loading…
Cancel
Save