|
|
@@ -8,7 +8,7 @@ define([ |
|
|
|
|
|
|
|
mapOffset: { |
|
|
|
x: 10, |
|
|
|
y: 10 |
|
|
|
y: 82 |
|
|
|
}, |
|
|
|
|
|
|
|
extraScripts: [ |
|
|
@@ -16,18 +16,57 @@ define([ |
|
|
|
], |
|
|
|
|
|
|
|
mapFile: null, |
|
|
|
mapW: null, |
|
|
|
mapH: null, |
|
|
|
|
|
|
|
init: function() { |
|
|
|
this.mapFile = require('../' + this.relativeFolderName + '/maps/tutorial/map'); |
|
|
|
this.mapFile = require.nodeRequire('../../../mods/event-halloween/maps/tutorial/map'); |
|
|
|
this.mapW = this.mapFile.width; |
|
|
|
this.mapH = this.mapFile.height; |
|
|
|
|
|
|
|
this.events.on('onBeforeGetEventList', this.onBeforeGetEventList.bind(this)); |
|
|
|
this.events.on('onBeforeGetQuests', this.onBeforeGetQuests.bind(this)); |
|
|
|
this.events.on('onBeforeGetDialogue', this.onBeforeGetDialogue.bind(this)); |
|
|
|
this.events.on('onAfterGetZone', this.onAfterGetZone.bind(this)); |
|
|
|
this.events.on('onBeforeBuildLayerTile', this.onBeforeBuildLayerTile.bind(this)); |
|
|
|
this.events.on('onAfterGetLayerObjects', this.onAfterGetLayerObjects.bind(this)); |
|
|
|
}, |
|
|
|
|
|
|
|
getLayerTile: function(info) { |
|
|
|
info.cell = 3; |
|
|
|
onAfterGetLayerObjects: function(info) { |
|
|
|
if (info.map != 'tutorial') |
|
|
|
return; |
|
|
|
|
|
|
|
var layer = this.mapFile.layers.find(l => (l.name == info.layer)); |
|
|
|
if (layer) { |
|
|
|
var offset = this.mapOffset; |
|
|
|
var mapScale = this.mapFile.tilesets[0].tileheight; |
|
|
|
|
|
|
|
layer.objects.forEach(function(l) { |
|
|
|
var newO = extend(true, {}, l); |
|
|
|
newO.x += (offset.x * mapScale); |
|
|
|
newO.y += (offset.y * mapScale); |
|
|
|
|
|
|
|
info.objects.push(newO); |
|
|
|
}, this); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
onBeforeBuildLayerTile: function(info) { |
|
|
|
if (info.map != 'tutorial') |
|
|
|
return; |
|
|
|
|
|
|
|
var offset = this.mapOffset; |
|
|
|
|
|
|
|
var x = info.x; |
|
|
|
var y = info.y; |
|
|
|
|
|
|
|
if ((x - offset.x < 0) || (y - offset.y < 0) || (x - offset.x >= this.mapW) || (y - offset.y >= this.mapH)) |
|
|
|
return; |
|
|
|
|
|
|
|
var i = ((y - offset.y) * this.mapW) + (x - offset.x); |
|
|
|
var layer = this.mapFile.layers.find(l => (l.name == info.layer)); |
|
|
|
if (layer) |
|
|
|
info.cell = layer.data[i]; |
|
|
|
}, |
|
|
|
|
|
|
|
onBeforeGetEventList: function(zone, list) { |
|
|
|