From aa77d3b78fd3339f46ff692b48a44f8a968c549f Mon Sep 17 00:00:00 2001 From: Big Bad Waffle Date: Tue, 21 Mar 2017 16:09:24 +0200 Subject: [PATCH] Fixes #124 --- src/server/components/inventory.js | 3 + src/server/components/notice.js | 7 + src/server/components/player.js | 2 +- src/server/config/maps/mapList.js | 1 - src/server/config/maps/tutorial/map.json | 169 +++++++++++++++++++++-- src/server/config/maps/tutorial/zone.js | 24 ++++ src/server/world/atlas.js | 4 +- src/server/world/instancer.js | 15 +- 8 files changed, 202 insertions(+), 23 deletions(-) diff --git a/src/server/components/inventory.js b/src/server/components/inventory.js index 04cd1ff2..adeca906 100644 --- a/src/server/components/inventory.js +++ b/src/server/components/inventory.js @@ -565,6 +565,9 @@ define([ var blueprints = blueprint.blueprints; for (var i = 0; i < blueprints.length; i++) { var drop = blueprints[i]; + if ((drop.maxLevel) && (drop.maxLevel < killSource.stats.values.level)) + continue; + drop.level = drop.level || level; drop.magicFind = magicFind; diff --git a/src/server/components/notice.js b/src/server/components/notice.js index 5a221fb6..7417163b 100644 --- a/src/server/components/notice.js +++ b/src/server/components/notice.js @@ -11,10 +11,13 @@ define([ syncer: null, + maxLevel: 0, + init: function(blueprint) { this.msg = blueprint.msg; this.actions = blueprint.actions || {}; this.announce = blueprint.announce; + this.maxLevel = blueprint.maxLevel || 0; this.syncer = this.obj.instance.syncer; }, @@ -43,6 +46,8 @@ define([ collisionEnter: function(obj) { if (!obj.player) return; + else if ((this.maxLevel) && (obj.stats.values.level > this.maxLevel)) + return; this.callAction(obj, 'enter'); @@ -67,6 +72,8 @@ define([ collisionExit: function(obj) { if (!obj.player) return; + else if ((this.maxLevel) && (obj.stats.values.level > this.maxLevel)) + return; this.callAction(obj, 'exit'); diff --git a/src/server/components/player.js b/src/server/components/player.js index c35d6321..c9b6afa4 100644 --- a/src/server/components/player.js +++ b/src/server/components/player.js @@ -32,7 +32,7 @@ define([ previewSpritesheet: character.previewSpritesheet, name: character.name, class: character.class, - zoneName: character.zoneName || 'tutorial-cove', + zoneName: character.zoneName || 'tutorial', x: character.x, y: character.y, account: character.account, diff --git a/src/server/config/maps/mapList.js b/src/server/config/maps/mapList.js index 12a5b67e..45f207d2 100644 --- a/src/server/config/maps/mapList.js +++ b/src/server/config/maps/mapList.js @@ -4,7 +4,6 @@ define([ ) { return [ - 'tutorial-cove', 'tutorial', 'estuary', 'city', diff --git a/src/server/config/maps/tutorial/map.json b/src/server/config/maps/tutorial/map.json index dc491ca9..ca23ad6e 100644 --- a/src/server/config/maps/tutorial/map.json +++ b/src/server/config/maps/tutorial/map.json @@ -140,8 +140,8 @@ "type":"", "visible":true, "width":8, - "x":688, - "y":712 + "x":672, + "y":672 }, { "gid":229, @@ -556,8 +556,8 @@ "type":"", "visible":true, "width":8, - "x":648, - "y":536 + "x":592, + "y":544 }, { "gid":229, @@ -732,8 +732,8 @@ "type":"", "visible":true, "width":8, - "x":656, - "y":632 + "x":672, + "y":504 }, { "gid":233, @@ -766,6 +766,38 @@ "width":8, "x":400, "y":320 + }, + { + "gid":229, + "height":8, + "id":626, + "name":"Seagull", + "properties": + { + + }, + "rotation":0, + "type":"", + "visible":true, + "width":8, + "x":616, + "y":688 + }, + { + "gid":229, + "height":8, + "id":635, + "name":"Crazed Seagull", + "properties": + { + + }, + "rotation":0, + "type":"", + "visible":true, + "width":8, + "x":616, + "y":808 }], "opacity":1, "properties": @@ -1001,6 +1033,126 @@ "width":24, "x":632, "y":400 + }, + { + "height":112, + "id":627, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 1, \"msg\": \"You open your eyes and cough. Saltwater burns your throat. You remember the storm, and the crash that left your ship in pieces.

You realize you need to find shelter. Use wasd<\/font> or the arrow keys<\/font> to move.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":120, + "x":384, + "y":824 + }, + { + "height":32, + "id":628, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 1, \"msg\": \"You take a few steps, still weak from the ordeal. Through the glare of the sun, you see a creature to the north-east.

Press v<\/font> to toggle nameplates.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":48, + "x":520, + "y":824 + }, + { + "height":80, + "id":629, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 1, \"msg\": \"You take a few steps, still weak from the ordeal. Through the glare of the sun, you see a creature to the north-east.

Press v<\/font> to toggle nameplates.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":136, + "x":504, + "y":856 + }, + { + "height":40, + "id":630, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 2, \"msg\": \"The seagull's eyes are bloodshot and in its beak you see a glinting locket. It stole your family heirloom!

Click on it to target it then press 1<\/font> to toggle auto-attack. Remember to stand close if you are a warrior or thief.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":8, + "x":568, + "y":800 + }, + { + "height":8, + "id":631, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 1, \"msg\": \"You take a few steps, still weak from the ordeal. Through the glare of the sun, you see a creature to the north-east.

Press v<\/font> to toggle nameplates.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":8, + "x":568, + "y":848 + }, + { + "height":40, + "id":632, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 1, \"msg\": \"You can loot items by standing on them then open your inventory with i<\/font>.

To equip an item, simply click on the item in your inventory.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":144, + "x":568, + "y":760 + }, + { + "height":32, + "id":633, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 1, \"msg\": \"You can loot items by standing on them then open your inventory with i<\/font>.

To equip an item, simply click on the item in your inventory.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":144, + "x":592, + "y":728 + }, + { + "height":56, + "id":634, + "name":"", + "properties": + { + "cpnNotice":"{\"maxLevel\": 2, \"msg\": \"The seagull's eyes are bloodshot and in its beak you see a glinting locket. It stole your family heirloom!

Click on it to target it then press 1<\/font> to toggle auto-attack. Remember to stand close if you are a warrior or thief.\"}" + }, + "rotation":0, + "type":"", + "visible":true, + "width":112, + "x":576, + "y":800 }], "opacity":1, "type":"objectgroup", @@ -1261,14 +1413,13 @@ "x":0, "y":0 }], - "nextobjectid":617, + "nextobjectid":636, "orientation":"orthogonal", "properties": { "instanced":"0", "name":"Test Zone", - "padding":"{\"tiles\":[[6,10],[7,5]]}", - "spawn":"{\"x\":72,\"y\":86}" + "spawn":"{\"x\":60,\"y\":116}" }, "renderorder":"right-down", "tileheight":8, diff --git a/src/server/config/maps/tutorial/zone.js b/src/server/config/maps/tutorial/zone.js index 54f2da71..4ef963e5 100644 --- a/src/server/config/maps/tutorial/zone.js +++ b/src/server/config/maps/tutorial/zone.js @@ -96,6 +96,30 @@ module.exports = { } } }, + 'crazed seagull': { + level: 1, + + rare: { + count: 0 + }, + + regular: { + drops: { + chance: 100, + rolls: 1, + noRandom: true, + blueprints: [{ + maxLevel: 1, + name: 'Family Heirloom', + quality: 2, + slot: 'neck', + type: 'Pendant', + noSalvage: true, + stats: ['hpMax', 'regenHp', 'regenMana'] + }] + } + } + }, seagull: { level: 2, regular: { diff --git a/src/server/world/atlas.js b/src/server/world/atlas.js index 006d58da..4595fbe7 100644 --- a/src/server/world/atlas.js +++ b/src/server/world/atlas.js @@ -27,7 +27,7 @@ define([ instanceId = -1; if (!thread) { - thread = this.getThreadFromName('tutorial-cove'); + thread = this.getThreadFromName('tutorial'); obj.zoneName = thread.name; } @@ -172,7 +172,7 @@ define([ var thread = this.getThreadFromName(obj.zoneName); if (!thread) { - thread = this.getThreadFromName('tutorial-cove'); + thread = this.getThreadFromName('tutorial'); obj.zoneName = thread.name; serverObj.zoneName = thread.name; } diff --git a/src/server/world/instancer.js b/src/server/world/instancer.js index 5579ea6e..a81d1caf 100644 --- a/src/server/world/instancer.js +++ b/src/server/world/instancer.js @@ -140,13 +140,11 @@ define([ objects.addObject(obj, this.onAddObject.bind(this)); else { var o = objects.transferObject(obj); - if (o.zoneName != 'tutorial-cove') - questBuilder.obtain(o); + questBuilder.obtain(o); } }, onAddObject: function(obj) { - if (obj.zoneName != 'tutorial-cove') - questBuilder.obtain(obj); + questBuilder.obtain(obj); }, updateObject: function(msg) { var obj = objects.find(o => o.serverId == msg.id); @@ -360,9 +358,7 @@ define([ } obj.instance.spawners.scale(obj.stats.values.level); - - if (obj.zoneName != 'tutorial-cove') - obj.instance.questBuilder.obtain(obj); + obj.instance.questBuilder.obtain(obj); }, updateObject: function(msg) { var id = msg.id; @@ -502,9 +498,8 @@ define([ obj = instance.objects.transferObject(objToAdd); obj.x = instance.map.spawn.x; obj.y = instance.map.spawn.y; - if (obj.zoneName != 'tutorial-cove') - instance.questBuilder.obtain(obj); - + + instance.questBuilder.obtain(obj); obj.instance.spawners.scale(obj.stats.values.level); }