Browse Source

main map chhanges

tags/v0.1.7^2
Big Bad Waffle 6 years ago
parent
commit
d34adaab1d
9 changed files with 483 additions and 278 deletions
  1. BIN
     
  2. BIN
     
  3. +34
    -34
      src/client/js/renderer.js
  4. +42
    -42
      src/client/js/rendering/renderer.js
  5. +8
    -9
      src/server/config/maps/cave/map.json
  6. +366
    -151
      src/server/config/maps/tutorial/map.json
  7. +23
    -32
      src/server/config/maps/tutorial/zone.js
  8. +6
    -6
      src/server/config/zoneBase.js
  9. +4
    -4
      src/server/mods/event-halloween/maps/tutorial/zone.js

BIN
View File


BIN
View File


+ 34
- 34
src/client/js/renderer.js View File

@@ -6,7 +6,7 @@ define([
'js/rendering/tileOpacity',
'js/rendering/particles',
'js/rendering/shaders/outline'
], function(
], function (
resources,
events,
physics,
@@ -61,7 +61,7 @@ define([

lastTick: null,

init: function() {
init: function () {
PIXI.GC_MODES.DEFAULT = PIXI.GC_MODES.AUTO;
PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST;

@@ -87,7 +87,7 @@ define([
this.stage = new pixi.Container();

var layers = this.layers;
Object.keys(layers).forEach(function(l) {
Object.keys(layers).forEach(function (l) {
if (l == 'tileSprites') {
layers[l] = new pixi.particles.ParticleContainer(2500);
layers[l].layer = 'tiles';
@@ -98,12 +98,12 @@ define([
}, this);

var spriteNames = ['sprites', 'tiles', 'mobs', 'bosses', 'bigObjects', 'objects', 'characters', 'attacks', 'auras', 'walls', 'ui', 'animChar', 'animMob', 'animBoss'];
resources.spriteNames.forEach(function(s) {
resources.spriteNames.forEach(function (s) {
if (s.indexOf('.png') > -1)
spriteNames.push(s);
});

spriteNames.forEach(function(t) {
spriteNames.forEach(function (t) {
this.textures[t] = new pixi.BaseTexture(resources.sprites[t].image);
this.textures[t].scaleMode = pixi.SCALE_MODES.NEAREST;
}, this);
@@ -114,7 +114,7 @@ define([
});
},

toggleScreen: function() {
toggleScreen: function () {
var screenMode = 0;

var isFullscreen = (window.innerHeight == screen.height);
@@ -133,7 +133,7 @@ define([
}
},

buildTitleScreen: function() {
buildTitleScreen: function () {
this.titleScreen = true;

this.setPosition({
@@ -173,14 +173,14 @@ define([
}
},

onDeath: function(pos) {
onDeath: function (pos) {
this.setPosition({
x: (pos.x - (this.width / (scale * 2))) * scale,
y: (pos.y - (this.height / (scale * 2))) * scale
}, true);
},

onResize: function() {
onResize: function () {
var zoom = window.devicePixelRatio;

this.width = $('body').width() * zoom;
@@ -202,7 +202,7 @@ define([
events.emit('onResize');
},

getTexture: function(baseTex, cell, size) {
getTexture: function (baseTex, cell, size) {
size = size || 8;
var name = baseTex + '_' + cell;

@@ -220,7 +220,7 @@ define([
return cached;
},

clean: function() {
clean: function () {
var container = this.layers.tileSprites;
this.stage.removeChild(container);

@@ -228,7 +228,7 @@ define([
container.layer = 'tiles';
this.stage.addChild(container);

this.stage.children.sort(function(a, b) {
this.stage.children.sort(function (a, b) {
if (a.layer == 'tiles')
return -1;
else if (b.layer == 'tiles')
@@ -238,7 +238,7 @@ define([
}, this);
},

onGetMapCustomization: function(msg) {
onGetMapCustomization: function (msg) {
if (!msg.collide) {
var children = this.layers.tiles.children;
var cLen = children.length;
@@ -275,7 +275,7 @@ define([
physics.graph.grid[msg.x][msg.y] = !msg.collide;
},

buildTile: function(c, i, j) {
buildTile: function (c, i, j) {
var alpha = tileOpacity.map(c);
var canFlip = tileOpacity.canFlip(c);

@@ -297,7 +297,7 @@ define([
return tile;
},

onGetMap: function(msg) {
onGetMap: function (msg) {
this.titleScreen = false;
physics.init(msg.collisionMap);

@@ -309,7 +309,7 @@ define([
var hiddenTiles = msg.hiddenTiles;

this.hiddenRooms = msg.hiddenRooms;
this.hiddenRooms.forEach(function(h) {
this.hiddenRooms.forEach(function (h) {
h.container = new pixi.Container();
this.layers.hiders.addChild(h.container);

@@ -427,7 +427,7 @@ define([
}
}

this.stage.children.sort(function(a, b) {
this.stage.children.sort(function (a, b) {
if (a.layer == 'tiles')
return -1;
else if (b.layer == 'tiles')
@@ -440,13 +440,13 @@ define([
events.emit('onRezone', this.zoneId);
this.zoneId = msg.zoneId;

msg.clientObjects.forEach(function(c) {
msg.clientObjects.forEach(function (c) {
c.zoneId = this.zoneId;
events.emit('onGetObject', c);
}, this);
},

setPosition: function(pos, instant) {
setPosition: function (pos, instant) {
pos.x += 16;
pos.y += 16;

@@ -463,7 +463,7 @@ define([
this.moveTo = pos;
},

hideHiders: function() {
hideHiders: function () {
var player = window.player;
if (!player)
return;
@@ -484,7 +484,7 @@ define([
}
},

update: function() {
update: function () {
var time = +new Date;

if (this.moveTo) {
@@ -526,14 +526,14 @@ define([
this.lastTick = time;
},

buildContainer: function(obj) {
buildContainer: function (obj) {
var container = new pixi.Container;
this.layers[obj.layerName || obj.sheetName].addChild(container);

return container;
},

buildRectangle: function(obj) {
buildRectangle: function (obj) {
var graphics = new pixi.Graphics;

var alpha = obj.alpha;
@@ -582,7 +582,7 @@ define([
points[9] = obj.y;
},

buildObject: function(obj) {
buildObject: function (obj) {
var w = 8;
var h = 8;
if (obj.w) {
@@ -631,7 +631,7 @@ define([
return sprite;
},

addFilter: function(sprite) {
addFilter: function (sprite) {
var thickness = 16;
if (sprite.width > scale)
thickness = 8;
@@ -646,14 +646,14 @@ define([
return filter;
},

removeFilter: function(sprite, filter) {
removeFilter: function (sprite, filter) {
if (!sprite.filters)
return;

sprite.filters = null;
},

buildText: function(obj) {
buildText: function (obj) {
var textSprite = new pixi.Text(obj.text, {
fontFamily: 'bitty',
fontSize: (obj.fontSize || 14),
@@ -672,15 +672,15 @@ define([
return textSprite;
},

buildEmitter: function(config) {
buildEmitter: function (config) {
return particles.buildEmitter(config);
},

destroyEmitter: function(emitter) {
destroyEmitter: function (emitter) {
particles.destroyEmitter(emitter);
},

setSprite: function(obj) {
setSprite: function (obj) {
var cell = obj.cell;
var y = ~~(cell / 8);
var x = cell - (y * 8);
@@ -689,21 +689,21 @@ define([
obj.sprite.texture = this.getTexture(obj.sheetName, obj.cell, obj.sprite.width / scaleMult);
},

reorder: function(sprite) {
reorder: function (sprite) {
var mobLayer = this.layers.mobs;
var mobs = mobLayer.children;
mobs.sort(function(a, b) {
mobs.sort(function (a, b) {
return (b.y - a.y);
});
},

destroyObject: function(obj) {
destroyObject: function (obj) {
if (!obj.sprite.parent)
return;
obj.sprite.parent.removeChild(obj.sprite);
},

render: function() {
render: function () {
if (!this.stage)
return;



+ 42
- 42
src/client/js/rendering/renderer.js View File

@@ -8,7 +8,7 @@ define([
'js/rendering/shaders/outline',
'js/rendering/spritePool',
'picture'
], function(
], function (
resources,
events,
physics,
@@ -71,7 +71,7 @@ define([

hiddenRooms: null,

init: function() {
init: function () {
PIXI.GC_MODES.DEFAULT = PIXI.GC_MODES.AUTO;
PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST;

@@ -97,7 +97,7 @@ define([
this.stage = new pixi.Container();

var layers = this.layers;
Object.keys(layers).forEach(function(l) {
Object.keys(layers).forEach(function (l) {
if (l == 'tileSprites') {
layers[l] = new pixi.Container();
layers[l].layer = 'tiles';
@@ -108,12 +108,12 @@ define([
}, this);

var spriteNames = ['tiles', 'mobs', 'bosses', 'animBigObjects', 'bigObjects', 'objects', 'characters', 'attacks', 'auras', 'walls', 'ui', 'animChar', 'animMob', 'animBoss', 'white', 'ray'];
resources.spriteNames.forEach(function(s) {
resources.spriteNames.forEach(function (s) {
if (s.indexOf('.png') > -1)
spriteNames.push(s);
});

spriteNames.forEach(function(t) {
spriteNames.forEach(function (t) {
this.textures[t] = new pixi.BaseTexture(resources.sprites[t].image);
this.textures[t].scaleMode = pixi.SCALE_MODES.NEAREST;
}, this);
@@ -127,11 +127,11 @@ define([
this.buildSpritesTexture();
},

buildSpritesTexture: function() {
buildSpritesTexture: function () {
var container = new pixi.Container();

var totalHeight = 0;
['tiles', 'walls', 'objects'].forEach(function(t) {
['tiles', 'walls', 'objects'].forEach(function (t) {
var texture = this.textures[t];
var tile = new pixi.Sprite(new pixi.Texture(texture));
tile.width = texture.width;
@@ -151,7 +151,7 @@ define([
this.textures.scaleMult = pixi.SCALE_MODES.NEAREST;
},

toggleScreen: function() {
toggleScreen: function () {
var screenMode = 0;

var isFullscreen = (window.innerHeight == screen.height);
@@ -170,7 +170,7 @@ define([
}
},

buildTitleScreen: function() {
buildTitleScreen: function () {
this.titleScreen = true;

this.setPosition({
@@ -239,14 +239,14 @@ define([
}
},

onDeath: function(pos) {
onDeath: function (pos) {
this.setPosition({
x: (pos.x - (this.width / (scale * 2))) * scale,
y: (pos.y - (this.height / (scale * 2))) * scale
}, true);
},

onResize: function() {
onResize: function () {
var zoom = window.devicePixelRatio;

this.width = $('body').width() * zoom;
@@ -271,7 +271,7 @@ define([
events.emit('onResize');
},

getTexture: function(baseTex, cell, size) {
getTexture: function (baseTex, cell, size) {
size = size || 8;
var name = baseTex + '_' + cell;

@@ -289,7 +289,7 @@ define([
return cached;
},

clean: function() {
clean: function () {
var container = this.layers.tileSprites;
this.stage.removeChild(container);

@@ -297,7 +297,7 @@ define([
container.layer = 'tiles';
this.stage.addChild(container);

this.stage.children.sort(function(a, b) {
this.stage.children.sort(function (a, b) {
if (a.layer == 'tiles')
return -1;
else if (b.layer == 'tiles')
@@ -307,7 +307,7 @@ define([
}, this);
},

onGetMapCustomization: function(msg) {
onGetMapCustomization: function (msg) {
if (!msg.collide) {
var children = this.layers.tiles.children;
var cLen = children.length;
@@ -344,7 +344,7 @@ define([
physics.graph.grid[msg.x][msg.y] = !msg.collide;
},

buildTile: function(c, i, j) {
buildTile: function (c, i, j) {
var alpha = tileOpacity.map(c);
var canFlip = tileOpacity.canFlip(c);

@@ -366,7 +366,7 @@ define([
return tile;
},

onGetMap: function(msg) {
onGetMap: function (msg) {
this.titleScreen = false;
physics.init(msg.collisionMap);

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

this.sprites = _.get2dArray(w, h, 'array');

this.stage.children.sort(function(a, b) {
this.stage.children.sort(function (a, b) {
if (a.layer == 'tiles')
return -1;
else if (b.layer == 'tiles')
@@ -397,18 +397,18 @@ define([
events.emit('onRezone', this.zoneId);
this.zoneId = msg.zoneId;

msg.clientObjects.forEach(function(c) {
msg.clientObjects.forEach(function (c) {
c.zoneId = this.zoneId;
events.emit('onGetObject', c);
}, this);
},

buildHiddenRooms: function(msg) {
buildHiddenRooms: function (msg) {
var hiddenWalls = msg.hiddenWalls;
var hiddenTiles = msg.hiddenTiles;

this.hiddenRooms = msg.hiddenRooms;
this.hiddenRooms.forEach(function(h) {
this.hiddenRooms.forEach(function (h) {
h.container = new pixi.Container();
this.layers.hiders.addChild(h.container);
this.buildRectangle({
@@ -421,7 +421,7 @@ define([
});
for (var i = h.x; i < h.x + h.width; i++) {
for (var j = h.y; j < h.y + h.height; j++) {
[hiddenTiles, hiddenWalls].forEach(function(k) {
[hiddenTiles, hiddenWalls].forEach(function (k) {
var cell = k[i][j];
if (cell == 0)
return;
@@ -435,7 +435,7 @@ define([
}
}, this);
},
hideHiders: function() {
hideHiders: function () {
var player = window.player;
if (!player)
return;
@@ -456,7 +456,7 @@ define([
}
},

setPosition: function(pos, instant) {
setPosition: function (pos, instant) {
pos.x += 16;
pos.y += 16;

@@ -473,7 +473,7 @@ define([
this.updateSprites();
},

isVisible: function(x, y) {
isVisible: function (x, y) {
var stage = this.stage;
var sx = -stage.x;
var sy = -stage.y;
@@ -484,7 +484,7 @@ define([
return (!((x < sx) || (y < sy) || (x >= sx + sw) || (y >= sy + sh)));
},

updateSprites: function() {
updateSprites: function () {
if (this.titleScreen)
return;

@@ -584,13 +584,13 @@ define([

//Reorder
if (addedSprite) {
container.children.sort(function(a, b) {
container.children.sort(function (a, b) {
return (a.sheetNum - b.sheetNum);
});
}
},

update: function() {
update: function () {
var time = +new Date;

if (this.moveTo) {
@@ -637,14 +637,14 @@ define([
this.lastTick = time;
},

buildContainer: function(obj) {
buildContainer: function (obj) {
var container = new pixi.Container;
this.layers[obj.layerName || obj.sheetName].addChild(container);

return container;
},

buildRectangle: function(obj) {
buildRectangle: function (obj) {
var graphics = new pixi.Graphics;

var alpha = obj.alpha;
@@ -672,7 +672,7 @@ define([
return graphics;
},

moveRectangle: function(obj) {
moveRectangle: function (obj) {
obj.sprite.position.x = obj.x;
obj.sprite.position.y = obj.y;
obj.sprite.width = obj.w;
@@ -718,7 +718,7 @@ define([
points[9] = obj.y;*/
},

buildObject: function(obj) {
buildObject: function (obj) {
var w = 8;
var h = 8;
if (obj.w) {
@@ -760,7 +760,7 @@ define([
return sprite;
},

addFilter: function(sprite) {
addFilter: function (sprite) {
var thickness = 16;
if (sprite.width > scale)
thickness = 8;
@@ -775,14 +775,14 @@ define([
return filter;
},

removeFilter: function(sprite, filter) {
removeFilter: function (sprite, filter) {
if (!sprite.filters)
return;

sprite.filters = null;
},

buildText: function(obj) {
buildText: function (obj) {
var textSprite = new pixi.Text(obj.text, {
fontFamily: 'bitty',
fontSize: (obj.fontSize || 14),
@@ -801,15 +801,15 @@ define([
return textSprite;
},

buildEmitter: function(config) {
buildEmitter: function (config) {
return particles.buildEmitter(config);
},

destroyEmitter: function(emitter) {
destroyEmitter: function (emitter) {
particles.destroyEmitter(emitter);
},

setSprite: function(obj) {
setSprite: function (obj) {
var cell = obj.cell;
var y = ~~(cell / 8);
var x = cell - (y * 8);
@@ -818,21 +818,21 @@ define([
obj.sprite.texture = this.getTexture(obj.sheetName, obj.cell, obj.sprite.width / scaleMult);
},

reorder: function(sprite) {
reorder: function (sprite) {
var mobLayer = this.layers.mobs;
var mobs = mobLayer.children;
mobs.sort(function(a, b) {
mobs.sort(function (a, b) {
return (b.y - a.y);
});
},

destroyObject: function(obj) {
destroyObject: function (obj) {
if (!obj.sprite.parent)
return;
obj.sprite.parent.removeChild(obj.sprite);
},

render: function() {
render: function () {
if (!this.stage)
return;



+ 8
- 9
src/server/config/maps/cave/map.json View File

@@ -2363,7 +2363,7 @@
"name":"|portalEntry",
"properties":
{
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":70,\"y\":16}}"
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":71,\"y\":16}}"
},
"propertytypes":
{
@@ -2403,7 +2403,7 @@
"name":"exit|portalEntry",
"properties":
{
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":70,\"y\":16}}"
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":71,\"y\":16}}"
},
"propertytypes":
{
@@ -2423,7 +2423,7 @@
"name":"|portalEntry",
"properties":
{
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":70,\"y\":16}}"
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":71,\"y\":16}}"
},
"propertytypes":
{
@@ -2443,7 +2443,7 @@
"name":"|portalEntry",
"properties":
{
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":70,\"y\":16}}"
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":71,\"y\":16}}"
},
"propertytypes":
{
@@ -2463,7 +2463,7 @@
"name":"|portalEntry",
"properties":
{
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":70,\"y\":16}}"
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":71,\"y\":16}}"
},
"propertytypes":
{
@@ -2523,7 +2523,7 @@
"name":"|portalEntry",
"properties":
{
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":70,\"y\":16}}"
"cpnPortal":"{\"zone\":\"tutorial\",\"pos\":{\"x\":71,\"y\":16}}"
},
"propertytypes":
{
@@ -2542,7 +2542,7 @@
"x":0,
"y":0
}],
"nextobjectid":921,
"nextobjectid":922,
"orientation":"orthogonal",
"properties":
{
@@ -2557,7 +2557,6 @@
"spawn":"string"
},
"renderorder":"right-down",
"tiledversion":"1.0.3",
"tileheight":8,
"tilesets":[
{
@@ -2803,6 +2802,6 @@
}],
"tilewidth":8,
"type":"map",
"version":1,
"version":"2017.05.26",
"width":192
}

+ 366
- 151
src/server/config/maps/tutorial/map.json
File diff suppressed because it is too large
View File


+ 23
- 32
src/server/config/maps/tutorial/zone.js View File

@@ -42,7 +42,7 @@ module.exports = {
'estuary entrance': {
components: {
cpnParticles: {
simplify: function() {
simplify: function () {
return {
type: 'particles',
blueprint: {
@@ -141,22 +141,6 @@ module.exports = {
sprite: [0, 0]
}
},
"captain squash": {
level: 2,
regular: {
drops: {
chance: 75,
rolls: 1
}
},
rare: {
count: 0
},
questItem: {
name: 'Gull Feather',
sprite: [0, 0]
}
},
bunny: {
level: 3,
regular: {
@@ -174,7 +158,7 @@ module.exports = {
}
},
elk: {
level: 5,
level: 4,
regular: {
drops: {
chance: 55,
@@ -189,10 +173,19 @@ module.exports = {
sprite: [0, 2]
}
},
flamingo: {
level: 5,
regular: {
drops: {
chance: 55,
rolls: 1
}
}
},
crab: {
faction: 'gaekatla',
deathRep: -3,
level: 7,
level: 6,

regular: {
drops: {
@@ -211,7 +204,7 @@ module.exports = {
'titan crab': {
faction: 'gaekatla',
deathRep: -5,
level: 8,
level: 7,
rare: {
name: 'The Pincer King'
}
@@ -229,17 +222,15 @@ module.exports = {
min: 3,
max: 5
},
forceItems: [
{
name: 'Flimsy Fishing Rod',
type: 'Fishing Rod',
slot: 'tool',
quality: 0,
worth: 5,
sprite: [11, 0],
infinite: true
}
],
forceItems: [{
name: 'Flimsy Fishing Rod',
type: 'Fishing Rod',
slot: 'tool',
quality: 0,
worth: 5,
sprite: [11, 0],
infinite: true
}],
level: {
min: 1,
max: 5
@@ -283,4 +274,4 @@ module.exports = {
}
}
}
};
};

+ 6
- 6
src/server/config/zoneBase.js View File

@@ -1,12 +1,12 @@
define([
], function(
], function (
) {
return {
objects: {
default: {
}
},
mobs: {
@@ -32,7 +32,7 @@ define([

rare: {
count: 1,
chance: 1,
chance: 0.4,

hpMult: 1.5,
dmgMult: 1.5,
@@ -57,4 +57,4 @@ define([
}
}
};
});
});

+ 4
- 4
src/server/mods/event-halloween/maps/tutorial/zone.js View File

@@ -57,7 +57,7 @@ define([
quality: 3,
worth: {
currency: `Candy Corn`,
amount: 75
amount: 350
},
stats: {
int: 50,
@@ -74,7 +74,7 @@ define([
quality: 3,
worth: {
currency: `Candy Corn`,
amount: 75
amount: 350
},
stats: {
str: 25,
@@ -92,7 +92,7 @@ define([
quality: 3,
worth: {
currency: `Candy Corn`,
amount: 75
amount: 350
},
stats: {
dex: 50,
@@ -109,7 +109,7 @@ define([
quality: 3,
worth: {
currency: `Candy Corn`,
amount: 75
amount: 350
},
stats: {
str: 50,


Loading…
Cancel
Save