Ver a proveniência

fixes #1346

tags/v0.4.3^2
Big Bad Waffle há 4 anos
ascendente
cometimento
c211c08fa9
7 ficheiros alterados com 41 adições e 6 eliminações
  1. +5
    -1
      src/client/ui/templates/stash/stash.js
  2. +8
    -0
      src/client/ui/templates/stash/styles.less
  3. +1
    -0
      src/server/components/player.js
  4. +13
    -4
      src/server/components/stash.js
  5. +10
    -0
      src/server/config/roles.js
  6. +2
    -0
      src/server/security/sheets.js
  7. +2
    -1
      src/server/security/sheetsConfig.js

+ 5
- 1
src/client/ui/templates/stash/stash.js Ver ficheiro

@@ -35,11 +35,15 @@ define([
},

build: function () {
this.el.removeClass('scrolls');
if (window.player.stash.maxItems > 50)
this.el.addClass('scrolls');

let container = this.el.find('.grid')
.empty();

let items = this.items;
let iLen = Math.max(items.length, 50);
let iLen = Math.max(items.length, window.player.stash.maxItems);

for (let i = 0; i < iLen; i++) {
let item = items[i];


+ 8
- 0
src/client/ui/templates/stash/styles.less Ver ficheiro

@@ -10,4 +10,12 @@
background-color: @blackC;
padding-bottom: 7px;
}

&.scrolls {
width: 834px;

.grid {
width: 824px;
}
}
}

+ 1
- 0
src/server/components/player.js Ver ficheiro

@@ -75,6 +75,7 @@ module.exports = {
obj.addComponent('stash', {
items: character.stash
});
obj.stash.calculateMaxItems(roles.getExtraStashSlots(character.account));

let blueprintEffects = character.components.find(c => c.type === 'effects') || {};
if (blueprintEffects.effects) {


+ 13
- 4
src/server/components/stash.js Ver ficheiro

@@ -1,5 +1,7 @@
const cpnInventory = require('./inventory');

const maxItems = 50;

module.exports = {
type: 'stash',

@@ -7,6 +9,8 @@ module.exports = {
items: [],
changed: false,

maxItems,

init: function (blueprint) {
let items = blueprint.items || [];
let iLen = items.length;
@@ -18,6 +22,10 @@ module.exports = {
this.blueprint = blueprint;
},

calculateMaxItems: function (extraSlots) {
this.maxItems = maxItems + extraSlots;
},

getItem: function (item) {
//Material?
let exists = false;
@@ -57,7 +65,7 @@ module.exports = {
deposit: function (item) {
if (!this.active)
return;
else if (this.items.length >= 50) {
else if (this.items.length >= this.maxItems) {
let isMaterial = this.items.some(stashedItem => item.name === stashedItem.name && (item.quantity || item.material));
if (!isMaterial) {
this.obj.instance.syncer.queue('onGetMessages', {
@@ -137,12 +145,12 @@ module.exports = {
}
});

if (this.active && this.items.length > 50) {
if (this.active && this.items.length > this.maxItems) {
obj.instance.syncer.queue('onGetMessages', {
id: this.obj.id,
messages: [{
class: 'color-redA',
message: 'You have more than 50 items in your stash. In the next version (v0.3.1) you will lose all items that put you over the limit',
message: `You have more than ${this.maxItems} items in your stash. In the next version (v0.3.1) you will lose all items that put you over the limit`,
type: 'info'
}]
}, [obj.serverId]);
@@ -161,7 +169,8 @@ module.exports = {
return {
type: 'stash',
active: this.active,
items: this.items
items: this.items,
maxItems: this.maxItems
};
},



+ 10
- 0
src/server/config/roles.js Ver ficheiro

@@ -73,6 +73,16 @@ module.exports = {
return skins;
},

getExtraStashSlots: function (accountName) {
const account = this.getAccount(accountName);
if (!account)
return 0;

console.log(account);

return account.extraStashSlots || 0;
},

sendMessage: function (player, msg) {
msg = 'Only certain roles can ' + msg + ' at the moment';



+ 2
- 0
src/server/security/sheets.js Ver ficheiro

@@ -55,6 +55,8 @@ module.exports = {
o.messagePrefix = o.messageprefix;
delete o.messageprefix;

o.extraStashSlots = ~~o.extrastashslots;

if (typeof (o.items) === 'string')
o.items = JSON.parse(o.items || '[]');
if (typeof (o.skins) === 'string')


+ 2
- 1
src/server/security/sheetsConfig.js Ver ficheiro

@@ -12,6 +12,7 @@ module.exports = {
name: 'Key to the world',
sprite: [12, 0],
keyId: 'world'
}]
}],
extraStashSlots: 10
}]
};

Carregando…
Cancelar
Guardar