Browse Source

#1912

tags/v0.10.6.10^2
Shaun 2 years ago
parent
commit
01426b346b
5 changed files with 29 additions and 26 deletions
  1. +2
    -4
      src/server/clientComponents/spellbook.js
  2. +7
    -0
      src/server/components/player.js
  3. +2
    -10
      src/server/objects/objBase.js
  4. +3
    -1
      src/server/security/router.js
  5. +15
    -11
      src/server/security/routerConfig.js

+ 2
- 4
src/server/clientComponents/spellbook.js View File

@@ -102,9 +102,8 @@ define([
if (!target && this.target && (!this.hoverTarget || this.hoverTarget.id !== this.target.id)) {
client.request({
cpn: 'player',
method: 'queueAction',
method: 'castSpell',
data: {
action: 'spell',
priority: true,
target: null
}
@@ -193,9 +192,8 @@ define([

client.request({
cpn: 'player',
method: 'queueAction',
method: 'castSpell',
data: {
action: 'spell',
priority: input.isKeyDown('ctrl'),
spell: spell.id,
target: target,


+ 7
- 0
src/server/components/player.js View File

@@ -264,6 +264,13 @@ module.exports = {
});
},

castSpell: function (msg) {
atlas.queueAction(this.obj, {
action: 'spell',
data: msg.data
});
},

queueAction: function (msg) {
atlas.queueAction(this.obj, msg.data);
},


+ 2
- 10
src/server/objects/objBase.js View File

@@ -179,15 +179,7 @@ module.exports = {
queue: function (msg) {
const { action, auto, data: { priority } } = msg;

if (action === 'clearQueue') {
let spellbook = this.spellbook;
if (spellbook.isCasting())
spellbook.stopCasting();
else
this.clearQueue();
return;
} else if (action === 'spell') {
if (action === 'spell') {
let spellbook = this.spellbook;
const isCasting = spellbook.isCasting();

@@ -272,7 +264,7 @@ module.exports = {
if (!success)
this.clearQueue();
} else if (q.action === 'spell') {
let success = this.spellbook.cast(q);
let success = this.spellbook.cast(q.data);
if (!success)
this.performQueue();
}


+ 3
- 1
src/server/security/router.js View File

@@ -60,6 +60,8 @@ module.exports = {
return (typeof(value) !== 'string' && !Number.isFinite(value));
else if (dataType === 'integer')
return !Number.isInteger(value);
else if (dataType === 'integerNullOrPosition')
return !Number.isInteger(value) && value !== null && (typeof(value) !== 'object' && value.hasOwnProperty('x') && value.hasOwnProperty('y'));
else if (dataType === 'arrayOfStrings')
return (!Array.isArray(value) || value.some(v => typeof(v) !== 'string'));
else if (dataType === 'arrayOfIntegers')
@@ -141,7 +143,7 @@ module.exports = {

const result = this.signatureCorrect(msg, signature);

if (!result || msg.cpn !== 'player' || (msg.method !== 'performAction' && msg.method !== 'queueAction'))
if (!result || msg.cpn !== 'player' || msg.method !== 'performAction')
return result;

const signatureThreadMsg = signatures.threadCpnMethods[msg.data.cpn]?.[msg.data.method];


+ 15
- 11
src/server/security/routerConfig.js View File

@@ -149,26 +149,30 @@ const routerConfig = {
}
]
},
performAction: {
callback: 'deferred',
castSpell: {
callback: false,
data: [
{
key: 'cpn',
dataType: 'string'
key: 'priority',
dataType: 'boolean'
},
{
key: 'method',
dataType: 'string'
key: 'target',
dataType: 'integerNullOrPosition'
},
{
key: 'data',
dataType: 'object'
key: 'spell',
dataType: 'integer'
},
{
key: 'self',
dataType: 'boolean',
optional: true
}
]
},

queueAction: {
callback: false,
performAction: {
callback: 'deferred',
data: [
{
key: 'cpn',


Loading…
Cancel
Save