@@ -51,7 +51,8 @@ define([ | |||
'reputation', | |||
'mail', | |||
'wardrobe', | |||
'passives' | |||
'passives', | |||
'workbenchAlchemy' | |||
].forEach(function (u) { | |||
this.build(u); | |||
}, this); | |||
@@ -1,3 +1,5 @@ | |||
const effectTemplate = require('../config/effects/effectTemplate'); | |||
module.exports = { | |||
type: 'effects', | |||
@@ -157,7 +159,7 @@ module.exports = { | |||
typeTemplate = require('../' + result.url); | |||
} | |||
let builtEffect = extend(true, {}, typeTemplate); | |||
let builtEffect = extend(true, {}, effectTemplate, typeTemplate); | |||
for (let p in options) | |||
builtEffect[p] = options[p]; | |||
@@ -0,0 +1,104 @@ | |||
module.exports = { | |||
type: 'workbenchAlchemy', | |||
init: function (blueprint) { | |||
let o = this.obj.instance.objects.buildObjects([{ | |||
properties: { | |||
x: this.obj.x - 1, | |||
y: this.obj.y - 1, | |||
width: 3, | |||
height: 3, | |||
cpnNotice: { | |||
actions: { | |||
enter: { | |||
cpn: 'workbenchAlchemy', | |||
method: 'enterArea', | |||
targetId: this.obj.id, | |||
args: [] | |||
}, | |||
exit: { | |||
cpn: 'workbenchAlchemy', | |||
method: 'exitArea', | |||
targetId: this.obj.id, | |||
args: [] | |||
} | |||
} | |||
} | |||
} | |||
}]); | |||
}, | |||
exitArea: function (obj) { | |||
if (!obj.player) | |||
return; | |||
obj.syncer.setArray(true, 'serverActions', 'removeActions', { | |||
key: 'u', | |||
action: { | |||
targetId: this.obj.id, | |||
cpn: 'workbenchAlchemy', | |||
method: 'access' | |||
} | |||
}); | |||
this.obj.instance.syncer.queue('onCloseWorkbenchAlchemy', null, [obj.serverId]); | |||
}, | |||
enterArea: function (obj) { | |||
if (!obj.player) | |||
return; | |||
let msg = 'Press U to access the alchemy station'; | |||
obj.syncer.setArray(true, 'serverActions', 'addActions', { | |||
key: 'u', | |||
action: { | |||
targetId: this.obj.id, | |||
cpn: 'workbenchAlchemy', | |||
method: 'open' | |||
} | |||
}); | |||
this.obj.instance.syncer.queue('onGetAnnouncement', { | |||
src: this.obj.id, | |||
msg: msg | |||
}, [obj.serverId]); | |||
}, | |||
open: function (msg) { | |||
if (msg.sourceId == null) | |||
return; | |||
let obj = this.obj.instance.objects.objects.find(o => o.serverId === msg.sourceId); | |||
if ((!obj) || (!obj.player)) | |||
return; | |||
let thisObj = this.obj; | |||
if ((Math.abs(thisObj.x - obj.x) > 1) || (Math.abs(thisObj.y - obj.y) > 1)) | |||
return; | |||
this.obj.instance.syncer.queue('onOpenWorkbenchAlchemy', { | |||
workbenchId: this.obj.id | |||
}, [obj.serverId]); | |||
}, | |||
craft: function(msg) { | |||
let potions = [{ | |||
name: 'Lesser Healing Potion', | |||
type: 'consumable', | |||
sprite: [3, 1], | |||
spritesheet: 'server/mods/event-xmas/images/items.png', | |||
description: 'Sometimes you need an amount of health that exceeds the amount a Minor Healing Potion would afford but less than a regular Healing Potion would restore. This potion has you covered.', | |||
worth: 0, | |||
noSalvage: true, | |||
noAugment: true, | |||
uses: 1 | |||
}]; | |||
let obj = this.obj.instance.objects.objects.find(o => o.serverId === msg.sourceId); | |||
if ((!obj) || (!obj.player)) | |||
return; | |||
obj.inventory.getItem(extend(true, {}, potions[0])); | |||
} | |||
}; |
@@ -11,8 +11,12 @@ module.exports = { | |||
getFaction: function (id) { | |||
let mapping = this.mappings[id]; | |||
let faction = null; | |||
if (mapping) | |||
return require('../' + mapping); | |||
return require('./factions/' + id); | |||
faction = require('./' + mapping); | |||
else | |||
faction = require('./factions/' + id); | |||
return faction; | |||
} | |||
}; |
@@ -57,7 +57,7 @@ module.exports = { | |||
return; | |||
//Spawn a mob | |||
let mob = mob.instance.spawners.spawn({ | |||
let spawnedMob = mob.instance.spawners.spawn({ | |||
amountLeft: 1, | |||
blueprint: { | |||
x: mob.x, | |||
@@ -78,7 +78,7 @@ module.exports = { | |||
} | |||
}); | |||
mobBuilder.build(mob, { | |||
mobBuilder.build(spawnedMob, { | |||
level: item.level, | |||
faction: this.aggro.faction, | |||
walkDistance: 2, | |||
@@ -94,7 +94,7 @@ module.exports = { | |||
}] | |||
}, false, 'regular'); | |||
mob.follower.bindEvents(); | |||
spawnedMob.follower.bindEvents(); | |||
} | |||
} | |||
}, | |||
@@ -1312,7 +1312,7 @@ | |||
"visible":true, | |||
"width":8, | |||
"x":792, | |||
"y":336 | |||
"y":312 | |||
}, | |||
{ | |||
"gid":673, | |||
@@ -2067,7 +2067,7 @@ | |||
"visible":true, | |||
"width":48, | |||
"x":752, | |||
"y":320 | |||
"y":312 | |||
}, | |||
{ | |||
"height":8, | |||
@@ -2078,7 +2078,7 @@ | |||
"visible":true, | |||
"width":48, | |||
"x":752, | |||
"y":320 | |||
"y":328 | |||
}, | |||
{ | |||
"height":24, | |||
@@ -2153,6 +2153,18 @@ | |||
"width":32, | |||
"x":1552, | |||
"y":912 | |||
}, | |||
{ | |||
"gid":572, | |||
"height":8, | |||
"id":860, | |||
"name":"alchemy workbench", | |||
"rotation":0, | |||
"type":"", | |||
"visible":true, | |||
"width":8, | |||
"x":792, | |||
"y":336 | |||
}], | |||
"opacity":1, | |||
"type":"objectgroup", | |||
@@ -3519,7 +3531,7 @@ | |||
"x":0, | |||
"y":0 | |||
}], | |||
"nextobjectid":860, | |||
"nextobjectid":861, | |||
"orientation":"orthogonal", | |||
"properties": | |||
{ | |||
@@ -333,6 +333,59 @@ module.exports = { | |||
} | |||
} | |||
} | |||
}, | |||
'alchemy workbench': { | |||
components: { | |||
cpnParticles: { | |||
simplify: function () { | |||
return { | |||
type: 'particles', | |||
blueprint: { | |||
color: { | |||
start: ['ff4252', 'ff4252'], | |||
end: ['a82841', 'a82841'] | |||
}, | |||
scale: { | |||
start: { | |||
min: 2, | |||
max: 10 | |||
}, | |||
end: { | |||
min: 0, | |||
max: 2 | |||
} | |||
}, | |||
speed: { | |||
start: { | |||
min: 4, | |||
max: 16 | |||
}, | |||
end: { | |||
min: 2, | |||
max: 8 | |||
} | |||
}, | |||
lifetime: { | |||
min: 1, | |||
max: 4 | |||
}, | |||
randomScale: true, | |||
randomSpeed: true, | |||
chance: 0.2, | |||
randomColor: true, | |||
spawnType: 'rect', | |||
spawnRect: { | |||
x: -15, | |||
y: -28, | |||
w: 30, | |||
h: 8 | |||
} | |||
} | |||
}; | |||
} | |||
}, | |||
cpnWorkbenchAlchemy: {} | |||
} | |||
} | |||
}, | |||
mobs: { | |||
@@ -24,7 +24,8 @@ module.exports = { | |||
door: ['lock', 'unlock'], | |||
wardrobe: ['open', 'apply'], | |||
stats: ['respawn'], | |||
passives: ['tickNode', 'untickNode'] | |||
passives: ['tickNode', 'untickNode'], | |||
workbenchAlchemy: ['open', 'craft'] | |||
}; | |||
return ((secondaryAllowed[msg.data.cpn]) && (secondaryAllowed[msg.data.cpn].indexOf(msg.data.method) > -1)); | |||