Parcourir la source

more work to wquery

tags/v0.3.0
Big Bad Waffle il y a 5 ans
Parent
révision
d758a59199
10 fichiers modifiés avec 40 ajouts et 25 suppressions
  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 Voir le fichier

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


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




+ 1
- 1
src/client/index.html Voir le fichier

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


+ 2
- 4
src/client/js/components/inventory.js Voir le fichier

@@ -69,13 +69,11 @@ define([
if (item.level > stats.level) if (item.level > stats.level)
errors.push('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'); errors.push('stats');


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




+ 1
- 1
src/client/js/rendering/renderer.js Voir le fichier

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


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


this.stage = new pixi.Container(); this.stage = new pixi.Container();




+ 24
- 9
src/client/plugins/wquery.js Voir le fichier

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

const sq = { const sq = {
default: function (q) { default: function (q) {
const type = typeof(q); const type = typeof(q);
@@ -26,8 +28,11 @@ const sq = {
return sq.wrap(els); 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 () { parent: function () {
@@ -96,7 +101,8 @@ const sq = {
}, },


addClass: function (classNames) { 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; return this;
}, },


@@ -158,7 +164,13 @@ const sq = {
if (['left', 'top', 'width', 'height'].includes(c) && (!val.indexOf || val.indexOf('%') === -1)) if (['left', 'top', 'width', 'height'].includes(c) && (!val.indexOf || val.indexOf('%') === -1))
val += 'px'; 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; return this;
}, },
@@ -235,13 +247,16 @@ const sq = {
}, },


data: function (property, value) { 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) if (arguments.length === 1)
return this.dataSet[property];
return dataSet[property];


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


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


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


+ 3
- 3
src/client/ui/templates/tooltipItem/tooltipItem.js Voir le fichier

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


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


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


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


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


if (item.cd) { if (item.cd) {


+ 2
- 2
src/client/ui/templates/wardrobe/wardrobe.js Voir le fichier

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


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


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


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


apply: function () { apply: function () {


+ 1
- 1
src/client/ui/templates/workbench/workbench.js Voir le fichier

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


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


this.renderRecipes(msg.recipes); this.renderRecipes(msg.recipes);




+ 4
- 2
src/server/components/extensions/socialCommands.js Voir le fichier

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


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


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


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


+ 1
- 1
src/server/misc/mods.js Voir le fichier

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


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


cbDone(); cbDone();


Chargement…
Annuler
Enregistrer