Staging See merge request !115tags/v0.1.4^2
@@ -14,8 +14,8 @@ | |||
@red: #d43346; | |||
@blue: #3fa7dd; | |||
@green: #80f643; | |||
@greenB: #4ac441; | |||
@greenC: #386646; | |||
@blackA: #505360; | |||
@blackB: #3c3f4c; | |||
@@ -1,7 +1,7 @@ | |||
define([ | |||
'js/rendering/renderer' | |||
], function( | |||
renderer | |||
) { | |||
return { | |||
type: 'moveAnimation', | |||
@@ -114,6 +114,8 @@ define([ | |||
this.obj.setSpritePosition(); | |||
} | |||
renderer.updateSprites(); | |||
} | |||
}; | |||
}); |
@@ -80,7 +80,7 @@ define([ | |||
this.spells.splice(existIndex, 1, s); | |||
return; | |||
} | |||
if (this.spells.length - 1 >= s.id) | |||
this.spells.splice(s.id, 0, s); | |||
else | |||
@@ -141,7 +141,7 @@ define([ | |||
}, | |||
tabTarget: function() { | |||
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, this.target)); | |||
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, this.shiftDown, this.target)); | |||
}, | |||
build: function(destroy) { | |||
@@ -151,7 +151,7 @@ define([ | |||
data: { | |||
instanceModule: 'customMap', | |||
method: 'customize', | |||
data: { | |||
data: { | |||
tile: 189, | |||
direction: this.obj.keyboardMover.direction, | |||
destroy: destroy | |||
@@ -288,4 +288,4 @@ define([ | |||
this.targetSprite.y = this.target.y * scale; | |||
} | |||
}; | |||
}); | |||
}); |
@@ -46,7 +46,7 @@ define([ | |||
events.emit('onMobHover', mob); | |||
}, | |||
getClosest: function(x, y, maxDistance, fromMob, callback) { | |||
getClosest: function(x, y, maxDistance, reverse, fromMob, callback) { | |||
var objects = this.objects; | |||
var oLen = objects.length; | |||
@@ -79,7 +79,13 @@ define([ | |||
return (l.id == fromMob.id); | |||
}); | |||
return list[(fromIndex + 1) % list.length]; | |||
if (reverse) { | |||
fromIndex = (fromIndex === 0 ? list.length : fromIndex) - 1; | |||
} else { | |||
fromIndex = (fromIndex + 1) % list.length; | |||
} | |||
return list[fromIndex]; | |||
}, | |||
onRezone: function(oldZone) { | |||
@@ -341,4 +347,4 @@ define([ | |||
} | |||
} | |||
}; | |||
}); | |||
}); |
@@ -51,6 +51,11 @@ define([ | |||
moveSpeedMax: 1.50, | |||
moveSpeedInc: 0.5, | |||
lastUpdatePos: { | |||
x: 0, | |||
y: 0 | |||
}, | |||
zoneId: null, | |||
textures: {}, | |||
@@ -149,14 +154,43 @@ define([ | |||
for (var i = 0; i < w; i++) { | |||
for (var j = 0; j < h; j++) { | |||
var ii = i / 10; | |||
var alpha = Math.sin(((j * 0.2) % 5) + Math.cos(ii % 8)); | |||
var tile = 5; | |||
if (Math.random() < 0.4) | |||
tile = 6; | |||
var tile = new pixi.Sprite(this.getTexture('sprites', tile)); | |||
if (j < 7) | |||
tile = 5; | |||
//else if (j > 26) | |||
// tile = 3; | |||
else if (alpha < -0.2) | |||
tile = 3; | |||
else if (alpha < 0.2) | |||
tile = 4; | |||
else if ((alpha < 0.5) && (j > 7)) | |||
tile = 53; | |||
alpha = Math.random(); | |||
var alpha = Math.sin((i % 4) + Math.cos(j % 8)); | |||
if (tile == 5) | |||
alpha /= 2; | |||
alpha *= 2; | |||
else if (tile == 3) | |||
alpha *= 1; | |||
else if (tile == 4) | |||
alpha *= 1; | |||
else if (tile == 53) | |||
alpha *= 2; | |||
alpha = Math.min(Math.max(0.1, alpha), 0.8); | |||
if (Math.random() < 0.35) { | |||
tile = { | |||
'5': 6, | |||
'3': 0, | |||
'4': 1, | |||
'53': 54 | |||
}[tile]; | |||
} | |||
var tile = new pixi.Sprite(this.getTexture('sprites', tile)); | |||
tile.alpha = alpha; | |||
tile.position.x = i * scale; | |||
@@ -412,8 +446,13 @@ define([ | |||
var w = this.w; | |||
var h = this.h; | |||
var x = ~~player.x; | |||
var y = ~~player.y; | |||
var x = ~~((-this.stage.x / scale) + (this.width / (scale * 2))); | |||
var y = ~~((-this.stage.y / scale) + (this.height / (scale * 2))); | |||
this.lastUpdatePos.x = this.stage.x; | |||
this.lastUpdatePos.y = this.stage.y; | |||
var sprites = this.sprites; | |||
var map = this.map; | |||
var container = this.layers.tileSprites; | |||
@@ -421,10 +460,10 @@ define([ | |||
var sw = this.showTilesW; | |||
var sh = this.showTilesH; | |||
var lowX = Math.max(0, x - sw); | |||
var lowY = Math.max(0, y - sh); | |||
var highX = Math.min(w - 1, x + sw); | |||
var highY = Math.min(h - 1, y + sh); | |||
var lowX = Math.max(0, x - sw) + 2; | |||
var lowY = Math.max(0, y - sh) + 2; | |||
var highX = Math.min(w - 1, x + sw) - 2; | |||
var highY = Math.min(h - 1, y + sh) - 2; | |||
var addedSprite = false; | |||
@@ -536,8 +575,13 @@ define([ | |||
this.moveTo = null; | |||
} | |||
this.stage.x = -~~this.pos.x; | |||
this.stage.y = -~~this.pos.y; | |||
var stage = this.stage; | |||
stage.x = -~~this.pos.x; | |||
stage.y = -~~this.pos.y; | |||
var halfScale = scale / 2; | |||
if ((Math.abs(stage.x - this.lastUpdatePos.x) > halfScale) || (Math.abs(stage.y - this.lastUpdatePos.y) > halfScale)) | |||
this.updateSprites(); | |||
events.emit('onSceneMove'); | |||
} | |||
@@ -22,7 +22,10 @@ define([ | |||
this.on('.btnLogin', 'click', this.onLoginClick.bind(this)); | |||
this.on('.btnRegister', 'click', this.onRegisterClick.bind(this)); | |||
this.find('.right .buttons .button').on('click', this.redirect.bind(this)); | |||
this.find('.extra, .version') | |||
.appendTo($('<div class="uiLoginExtra"></div>>').appendTo('.ui-container')); | |||
$('.uiLoginExtra').find('.button').on('click', this.redirect.bind(this)); | |||
this.find('input') | |||
.on('keyup', this.onKeyDown.bind(this)) | |||
@@ -63,6 +66,7 @@ define([ | |||
if (!res) { | |||
uiFactory.build('characters', {}); | |||
$('.uiLoginExtra').remove(); | |||
this.el.remove(); | |||
} else | |||
this.el.find('.message').html(res); | |||
@@ -7,18 +7,18 @@ | |||
@logoWidth: 559px; | |||
@logoHeight: 200px; | |||
@boxHeight: 370px; | |||
@boxHeight: 169px; | |||
@messageHeight: @boxPadding; | |||
@totalWidth: (@leftWidth + @rightWidth + (@boxPadding * 2)); | |||
@totalWidth: @rightWidth; | |||
@totalHeight: (@logoHeight + @boxHeight + (@boxPadding * 3) + @messageHeight); | |||
.uiLogin { | |||
display: none; | |||
width: @totalWidth; | |||
height: @totalHeight; | |||
margin-top: -30px; | |||
margin-top: -80px; | |||
.logo { | |||
width: 562px; | |||
@@ -27,25 +27,30 @@ | |||
margin-bottom: (@boxPadding * 3); | |||
} | |||
.left, .right, .news { | |||
.right { | |||
height: @boxHeight; | |||
float: left; | |||
background-color: #3a3b4a; | |||
} | |||
.left { | |||
width: @leftWidth; | |||
padding: @boxPadding; | |||
} | |||
.right { | |||
width: @rightWidth; | |||
padding: @boxPadding; | |||
margin-left: (@boxPadding * 2); | |||
.label, input { | |||
float: left; | |||
} | |||
.label { | |||
width: 30%; | |||
padding-top: 10px; | |||
color: @green; | |||
} | |||
input { | |||
width: 70%; | |||
} | |||
input, .textbox, input:-webkit-autofill { | |||
box-shadow: 0 0 0px 1000px darken(@gray, 15%) inset; | |||
width: 100%; | |||
color: @white; | |||
-webkit-text-fill-color: @white; | |||
margin-bottom: @boxPadding; | |||
@@ -54,7 +59,6 @@ | |||
/* We duplicate this for firefox which doesn't like the webkit selector */ | |||
input, .textbox { | |||
box-shadow: 0 0 0px 1000px darken(@gray, 15%) inset; | |||
width: 100%; | |||
color: @white; | |||
-webkit-text-fill-color: @white; | |||
margin-bottom: @boxPadding; | |||
@@ -62,11 +66,26 @@ | |||
.message { | |||
height: @messageHeight; | |||
width: 100%; | |||
margin-top: @boxPadding; | |||
width: 200%; | |||
margin-left: -50%; | |||
margin-top: 36px; | |||
float: left; | |||
text-align: center; | |||
color: @redA; | |||
color: @orange; | |||
filter: | |||
brightness(100%) | |||
drop-shadow(0px -4px 0px @blackD) | |||
drop-shadow(0px 4px 0px @blackD) | |||
drop-shadow(4px 0px 0px @blackD) | |||
drop-shadow(-4px 0px 0px @blackD); | |||
-moz-filter: | |||
brightness(100%) | |||
drop-shadow(0px -4px 0px @blackD) | |||
drop-shadow(0px 4px 0px @blackD) | |||
drop-shadow(4px 0px 0px @blackD) | |||
drop-shadow(-4px 0px 0px @blackD); | |||
} | |||
.top-buttons { | |||
@@ -89,52 +108,55 @@ | |||
} | |||
} | |||
} | |||
} | |||
.buttons { | |||
width: 100%; | |||
height: 35px; | |||
margin-top: 80px; | |||
.button { | |||
width: 100%; | |||
margin-bottom: calc(@boxPadding / 2); | |||
background-color: @blueC; | |||
color: @white; | |||
&:hover { | |||
background-color: @blueB; | |||
} | |||
} | |||
} | |||
.spacer-h { | |||
height: 61px; | |||
} | |||
} | |||
.news { | |||
width: @leftWidth; | |||
padding: @boxPadding; | |||
.uiLoginExtra { | |||
.extra { | |||
position: absolute; | |||
left: 10px; | |||
bottom: 10px; | |||
.heading { | |||
background-color: @grayD; | |||
.button { | |||
padding-left: 10px; | |||
padding-right: 10px; | |||
width: 100%; | |||
margin-bottom: 10px; | |||
background-color: @blueD; | |||
color: @white; | |||
margin-bottom: 8px; | |||
text-align: center; | |||
height: 35px; | |||
padding-top: 9px; | |||
} | |||
.list { | |||
overflow-y: auto; | |||
padding: 16px; | |||
&:last-child { | |||
margin-bottom: 0px; | |||
} | |||
.item { | |||
text-align: justify; | |||
color: @grayB; | |||
margin-bottom: 22px; | |||
&:hover { | |||
background-color: @blueC; | |||
} | |||
} | |||
} | |||
.spacer-h { | |||
height: 61px; | |||
.version { | |||
position: absolute; | |||
right: 10px; | |||
bottom: 10px; | |||
color: @yellow; | |||
filter: | |||
brightness(100%) | |||
drop-shadow(0px -4px 0px @blackD) | |||
drop-shadow(0px 4px 0px @blackD) | |||
drop-shadow(4px 0px 0px @blackD) | |||
drop-shadow(-4px 0px 0px @blackD); | |||
-moz-filter: | |||
brightness(100%) | |||
drop-shadow(0px -4px 0px @blackD) | |||
drop-shadow(0px 4px 0px @blackD) | |||
drop-shadow(4px 0px 0px @blackD) | |||
drop-shadow(-4px 0px 0px @blackD); | |||
} | |||
} |
@@ -1,28 +1,20 @@ | |||
<div class="uiLogin"> | |||
<img class="logo" src="images/logo_4.png" alt=""> | |||
<div class="news"> | |||
<div class="heading">what's new</div> | |||
<div class="list"> | |||
<div class="item">Faction Quartermasters</div> | |||
<div class="item">New Unlockable Skin</div> | |||
<div class="item">New Map: City Sewer</div> | |||
<div class="item">Factions and Reputations</div> | |||
<div class="item">You can now filter the chat window</div> | |||
<div class="item">Prophecies. When creating a new character you can choose which prophecies to apply. This includes a permadeath prophecy called 'hardcore'.</div> | |||
</div> | |||
</div> | |||
<div class="right"> | |||
<div class="label">username</div> | |||
<input type="text" class="el textbox txtUsername" placeholder="username"> | |||
<div class="label">password</div> | |||
<input type="password" class="el textbox txtPassword" placeholder="password"> | |||
<div class="top-buttons"> | |||
<div class="el button btnRegister">register</div> | |||
<div class="el button btnLogin">login</div> | |||
</div> | |||
<div class="message"></div> | |||
<div class="buttons"> | |||
<div class="el button btnPatreon" location="http://patreon.com/bigbadwaffle">Pledge on Patreon</div> | |||
<div class="el button btnPaypal" location="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BR2CC82WUAVEA">Donate on Paypal</div> | |||
<div class="el button btnWiki" location="http://isleward.gamepedia.com/Isleward_Wiki">Access the Wiki</div> | |||
</div> | |||
</div> | |||
<div class="extra"> | |||
<div class="el button btnPatreon" location="http://patreon.com/bigbadwaffle">Pledge on Patreon</div> | |||
<div class="el button btnPaypal" location="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BR2CC82WUAVEA">Donate on Paypal</div> | |||
<div class="el button btnWiki" location="http://isleward.gamepedia.com/Isleward_Wiki">Access the Wiki</div> | |||
</div> | |||
<div class="version">v0.1.3</div> | |||
</div> |
@@ -1,5 +1,5 @@ | |||
define([ | |||
'bcrypt', | |||
'bcrypt-nodejs', | |||
'security/io', | |||
'misc/messages', | |||
'security/connections', | |||
@@ -243,7 +243,7 @@ define([ | |||
} | |||
}, | |||
onUnhashedLogin: function(msg) { | |||
bcrypt.hash(msg.data.password, 10, this.onPasswordHashed.bind(this, msg)); | |||
bcrypt.hash(msg.data.password, null, null, this.onPasswordHashed.bind(this, msg)); | |||
}, | |||
onPasswordHashed: function(msg, err, hashedPassword) { | |||
io.set({ | |||
@@ -294,7 +294,7 @@ define([ | |||
var credentials = msg.data; | |||
bcrypt.hash(credentials.password, 10, this.onHashGenerated.bind(this, msg)); | |||
bcrypt.hash(credentials.password, null, null, this.onHashGenerated.bind(this, msg)); | |||
}, | |||
onHashGenerated: function(msg, err, hashedPassword) { | |||
io.set({ | |||
@@ -0,0 +1,80 @@ | |||
define([ | |||
], function( | |||
) { | |||
return { | |||
type: 'follower', | |||
master: null, | |||
lifetime: -1, | |||
fGetHighest: { | |||
inCombat: null, | |||
outOfCombat: null | |||
}, | |||
bindEvents: function() { | |||
this.lifetime = 100; | |||
this.fGetHighest.inCombat = this.master.aggro.getHighest.bind(this.master.aggro); | |||
this.fGetHighest.outOfCombat = this.returnNoAggro.bind(this); | |||
}, | |||
returnNoAggro: function() { | |||
var master = this.master; | |||
var obj = this.obj; | |||
var mob = obj.mob; | |||
mob.originX = master.x + ~~((Math.random() * 2) * 2) - 1; | |||
mob.originY = master.y + ~~((Math.random() * 2) * 2) - 1; | |||
return null; | |||
}, | |||
despawn: function() { | |||
var obj = this.obj; | |||
obj.destroyed = true; | |||
this.obj.instance.syncer.queue('onGetObject', { | |||
x: obj.x, | |||
y: obj.y, | |||
components: [{ | |||
type: 'attackAnimation', | |||
row: 0, | |||
col: 4 | |||
}] | |||
}); | |||
}, | |||
update: function() { | |||
this.lifetime--; | |||
if (this.lifetime <= 0) { | |||
this.despawn(); | |||
return; | |||
} | |||
var obj = this.obj; | |||
var master = this.master; | |||
if (master.destroyed) { | |||
this.despawn(); | |||
return; | |||
} | |||
var doMove = ( | |||
(Math.abs(obj.x - master.x) >= 10) || | |||
(Math.abs(obj.y - master.y) >= 10) | |||
); | |||
if (doMove) { | |||
if (obj.aggro.getHighest == this.fGetHighest.inCombat) | |||
obj.mob.target = obj; | |||
} | |||
obj.aggro.getHighest = doMove ? this.fGetHighest.outOfCombat : this.fGetHighest.inCombat; | |||
} | |||
}; | |||
}); |
@@ -40,12 +40,14 @@ define([ | |||
item.spell.properties = item.spell.properties || {}; | |||
item.spell.properties.range = item.range; | |||
} | |||
} | |||
this.hookItemEvents(items); | |||
for (var i = 0; i < iLen; i++) { | |||
this.getItem(items[i], true); | |||
} | |||
this.hookItemEvents(); | |||
if ((this.obj.player) && (!isTransfer)) { | |||
this.getDefaultAbilities(); | |||
@@ -75,8 +77,8 @@ define([ | |||
this.hookItemEvents(); | |||
}, | |||
hookItemEvents: function() { | |||
var items = this.items; | |||
hookItemEvents: function(items) { | |||
var items = items || this.items; | |||
var iLen = items.length; | |||
for (var i = 0; i < iLen; i++) { | |||
var item = items[i]; | |||
@@ -31,7 +31,7 @@ define([ | |||
if (this.obj.aggro) | |||
target = this.obj.aggro.getHighest(); | |||
var goHome = false; | |||
if (target) { | |||
if ((target) && (target != this.obj)) { | |||
this.fight(target); | |||
return; | |||
} else if (this.target) { | |||
@@ -69,11 +69,13 @@ define([ | |||
}, [obj.serverId]); | |||
}, | |||
collisionExit: function(obj) { | |||
if (!obj.player) | |||
return; | |||
else if ((this.maxLevel) && (obj.stats.values.level > this.maxLevel)) | |||
return; | |||
collisionExit: function(obj, force) { | |||
if (!force) { | |||
if (!obj.player) | |||
return; | |||
else if ((this.maxLevel) && (obj.stats.values.level > this.maxLevel)) | |||
return; | |||
} | |||
this.callAction(obj, 'exit'); | |||
@@ -83,6 +85,13 @@ define([ | |||
this.syncer.queue('onRemoveDialogue', { | |||
src: this.obj.id | |||
}, [obj.serverId]); | |||
}, | |||
events: { | |||
onCellPlayerLevelUp: function(obj) { | |||
if ((this.maxLevel) && (obj.stats.values.level > this.maxLevel)) | |||
this.collisionExit(obj, true); | |||
} | |||
} | |||
}; | |||
}); |
@@ -150,8 +150,12 @@ define([ | |||
physics.removeObject(this.obj, this.obj.x, this.obj.y); | |||
if (!permadeath) { | |||
this.obj.x = this.obj.spawn.x; | |||
this.obj.y = this.obj.spawn.y; | |||
var level = this.obj.stats.values.level; | |||
var spawns = this.obj.spawn; | |||
var spawnPos = ((spawns.find(s => ((s.maxLevel) && (s.maxLevel >= level)))) || (spawns[0])); | |||
this.obj.x = spawnPos.x; | |||
this.obj.y = spawnPos.y; | |||
var syncer = this.obj.syncer; | |||
syncer.o.x = this.obj.x; | |||
@@ -156,45 +156,54 @@ define([ | |||
}, | |||
getXp: function(amount) { | |||
amount = ~~(amount * (1 + (this.values.xpIncrease / 100))); | |||
var obj = this.obj; | |||
var values = this.values; | |||
amount = ~~(amount * (1 + (values.xpIncrease / 100))); | |||
this.values.xpTotal = ~~(this.values.xpTotal + amount); | |||
this.values.xp = ~~(this.values.xp + amount); | |||
values.xpTotal = ~~(values.xpTotal + amount); | |||
values.xp = ~~(values.xp + amount); | |||
this.syncer.queue('onGetDamage', { | |||
id: this.obj.id, | |||
id: obj.id, | |||
event: true, | |||
text: '+' + amount + ' xp' | |||
}); | |||
var syncO = {}; | |||
var didLevelUp = false; | |||
while (this.values.xp >= this.values.xpMax) { | |||
while (values.xp >= values.xpMax) { | |||
didLevelUp = true; | |||
this.values.xp -= this.values.xpMax; | |||
this.values.level++; | |||
values.xp -= values.xpMax; | |||
values.level++; | |||
this.values.hpMax += 40; | |||
values.hpMax += 40; | |||
this.syncer.queue('onGetDamage', { | |||
id: this.obj.id, | |||
id: obj.id, | |||
event: true, | |||
text: 'level up' | |||
}); | |||
this.obj.syncer.setObject(true, 'stats', 'values', 'level', this.values.level); | |||
this.obj.syncer.setObject(true, 'stats', 'values', 'hpMax', this.values.hpMax); | |||
obj.syncer.setObject(true, 'stats', 'values', 'level', values.level); | |||
obj.syncer.setObject(true, 'stats', 'values', 'hpMax', values.hpMax); | |||
syncO.level = this.values.level; | |||
syncO.level = values.level; | |||
this.calcXpMax(); | |||
} | |||
if (didLevelUp) | |||
this.obj.auth.doSave(); | |||
if (didLevelUp) { | |||
var cellContents = obj.instance.physics.getCell(obj.x, obj.y); | |||
cellContents.forEach(function(c) { | |||
c.fireEvent('onCellPlayerLevelUp', obj); | |||
}); | |||
obj.auth.doSave(); | |||
} | |||
this.obj.syncer.setObject(true, 'stats', 'values', 'xp', this.values.xp); | |||
obj.syncer.setObject(true, 'stats', 'values', 'xp', this.values.xp); | |||
process.send({ | |||
method: 'object', | |||
@@ -237,13 +246,13 @@ define([ | |||
var amount = level * 10 * mult; | |||
if (Math.abs(levelDelta) <= 10) | |||
amount = ~~(((sourceLevel + levelDelta) * 10) * Math.pow(1 - (Math.abs(levelDelta) / 10), 2) * mult); | |||
else | |||
else | |||
amount = 0; | |||
a.obj.stats.getXp(amount, this.obj); | |||
} | |||
a.obj.fireEvent('afterKillMob', target); | |||
} | |||
@@ -315,6 +324,10 @@ define([ | |||
if (death.success) { | |||
var deathEvent = {}; | |||
var killSource = source; | |||
if (source.follower) | |||
killSource = source.follower.master; | |||
if (source.player) | |||
source.stats.kill(this.obj); | |||
else | |||
@@ -69,12 +69,20 @@ define([ | |||
y: mob.y, | |||
cell: 34, | |||
sheetName: 'mobs', | |||
name: 'Squiggle' | |||
name: 'Squiggle', | |||
properties: { | |||
cpnFollower: {} | |||
}, | |||
extraProperties: { | |||
follower: { | |||
master: this | |||
} | |||
} | |||
} | |||
}); | |||
mobBuilder.build(mob, { | |||
level: 5, | |||
level: item.level, | |||
faction: this.aggro.faction, | |||
walkDistance: 2, | |||
regular: { | |||
@@ -82,7 +90,14 @@ define([ | |||
hpMult: 1, | |||
dmgMult: 1 | |||
}, | |||
spells: [{ | |||
type: 'melee', | |||
damage: 1, | |||
statMult: 0.1 | |||
}] | |||
}, false, 'regular'); | |||
mob.follower.bindEvents(); | |||
} | |||
} | |||
}, | |||
@@ -111,7 +111,7 @@ module.exports = { | |||
}, | |||
faction: { | |||
id: 'gaekatla', | |||
tier: 6 | |||
tier: 5 | |||
}, | |||
markup: { | |||
buy: 0.25, | |||
@@ -1085,7 +1085,7 @@ | |||
"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!<br \/><br \/>Click on it to target it then press <font class='color-green'>1<\/font> to toggle auto-attack. Remember to stand close if you are a warrior or thief.\"}" | |||
"cpnNotice":"{\"maxLevel\": 1, \"msg\": \"The seagull's eyes are bloodshot and in its beak you see a glinting locket. It stole your family heirloom!<br \/><br \/>Click on it to target it then press <font class='color-green'>1<\/font> to toggle auto-attack. Remember to stand close if you are a warrior or thief.\"}" | |||
}, | |||
"rotation":0, | |||
"type":"", | |||
@@ -1130,7 +1130,7 @@ | |||
"name":"", | |||
"properties": | |||
{ | |||
"cpnNotice":"{\"maxLevel\": 2, \"msg\": \"You can loot items by standing on them then open your inventory with <font class='color-green'>i<\/font>.<br \/><br \/>To equip an item, simply right click the item in your inventory.\"}" | |||
"cpnNotice":"{\"maxLevel\": 2, \"msg\": \"Far to the north, you see a small shack. Civilization!<br \/><br \/>You can read more help by pressing <font class='color-green'>h<\/font>.\"}" | |||
}, | |||
"rotation":0, | |||
"type":"", | |||
@@ -1145,7 +1145,7 @@ | |||
"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!<br \/><br \/>Click on it to target it then press <font class='color-green'>1<\/font> to toggle auto-attack. Remember to stand close if you are a warrior or thief.\"}" | |||
"cpnNotice":"{\"maxLevel\": 1, \"msg\": \"The seagull's eyes are bloodshot and in its beak you see a glinting locket. It stole your family heirloom!<br \/><br \/>Click on it to target it then press <font class='color-green'>1<\/font> to toggle auto-attack. Remember to stand close if you are a warrior or thief.\"}" | |||
}, | |||
"rotation":0, | |||
"type":"", | |||
@@ -1419,7 +1419,7 @@ | |||
{ | |||
"instanced":"0", | |||
"name":"Test Zone", | |||
"spawn":"{\"x\":60,\"y\":116}" | |||
"spawn":"[{\"maxLevel\":1,\"x\":60,\"y\":116},{\"maxLevel\":2,\"x\":89,\"y\":48}]" | |||
}, | |||
"renderorder":"right-down", | |||
"tileheight":8, | |||
@@ -3,7 +3,7 @@ | |||
"version": "0.0.2", | |||
"description": "isleward", | |||
"dependencies": { | |||
"bcrypt": "^1.0.2", | |||
"bcrypt-nodejs": "0.0.3", | |||
"express": "^4.13.1", | |||
"extend": "^3.0.0", | |||
"less-middleware": "^2.0.1", | |||
@@ -124,15 +124,14 @@ define([ | |||
msg.keepPos = false; | |||
} | |||
var spawnPos = map.getSpawnPos(obj); | |||
if ((!msg.keepPos) || (obj.x == null)) { | |||
obj.x = map.spawn.x; | |||
obj.y = map.spawn.y; | |||
obj.x = spawnPos.x; | |||
obj.y = spawnPos.y; | |||
} | |||
obj.spawn = { | |||
x: map.spawn.x, | |||
y: map.spawn.y | |||
}; | |||
obj.spawn = map.spawn; | |||
syncer.queue('onGetMap', map.clientMap, [obj.serverId]); | |||
@@ -312,25 +311,23 @@ define([ | |||
msg.keepPos = false; | |||
} | |||
var spawnPos = map.getSpawnPos(obj); | |||
if ((!msg.keepPos) || (obj.x == null)) { | |||
obj.x = map.spawn.x; | |||
obj.y = map.spawn.y; | |||
obj.x = spawnPos.x; | |||
obj.y = spawnPos.y; | |||
} | |||
obj.spawn = { | |||
x: map.spawn.x, | |||
y: map.spawn.y | |||
}; | |||
obj.spawn = map.spawn; | |||
if (exists) { | |||
//Keep track of what the connection id is (sent from the server) | |||
obj.serverId = obj.id; | |||
delete obj.id; | |||
obj.spawn = { | |||
x: exists.map.spawn.x, | |||
y: exists.map.spawn.y | |||
}; | |||
var spawnPos = exists.map.getSpawnPos(obj); | |||
obj.spawn = exists.map.spawn; | |||
exists.syncer.queue('onGetMap', exists.map.clientMap, [obj.serverId]); | |||
@@ -353,8 +350,10 @@ define([ | |||
}, | |||
onAddObject: function(keepPos, obj) { | |||
if (!keepPos) { | |||
obj.x = obj.instance.map.spawn.x; | |||
obj.y = obj.instance.map.spawn.y; | |||
var spawnPos = obj.instance.map.getSpawnPos(obj); | |||
obj.x = spawnPos.x; | |||
obj.y = spawnPos.y; | |||
} | |||
obj.instance.spawners.scale(obj.stats.values.level); | |||
@@ -458,7 +457,8 @@ define([ | |||
questBuilder: extend(true, {}, questBuilder), | |||
map: { | |||
spawn: extend(true, {}, map.spawn), | |||
clientMap: extend(true, {}, map.clientMap) | |||
clientMap: extend(true, {}, map.clientMap), | |||
getSpawnPos: map.getSpawnPos.bind(map) | |||
} | |||
}; | |||
@@ -496,8 +496,11 @@ define([ | |||
obj = instance.objects.addObject(objToAdd, this.onAddObject.bind(this, false)); | |||
else { | |||
obj = instance.objects.transferObject(objToAdd); | |||
obj.x = instance.map.spawn.x; | |||
obj.y = instance.map.spawn.y; | |||
var spawnPos = instance.map.getSpawnPos(obj); | |||
obj.x = spawnPos.x; | |||
obj.y = spawnPos.y; | |||
instance.questBuilder.obtain(obj); | |||
obj.instance.spawners.scale(obj.stats.values.level); | |||
@@ -95,8 +95,11 @@ define([ | |||
if (this.instanced) | |||
this.instanced = (this.instanced == '1'); | |||
if (mapFile.properties.spawn) | |||
if (mapFile.properties.spawn) { | |||
this.spawn = JSON.parse(mapFile.properties.spawn); | |||
if (!this.spawn.push) | |||
this.spawn = [ this.spawn ]; | |||
} | |||
}, | |||
create: function() { | |||
this.getMapFile(); | |||
@@ -361,6 +364,13 @@ define([ | |||
this.objBlueprints.push(obj); | |||
} | |||
} | |||
}, | |||
getSpawnPos: function(obj) { | |||
var stats = obj.components.find(c => (c.type == 'stats')); | |||
var level = stats.values.level; | |||
return ((this.spawn.find(s => ((s.maxLevel) && (s.maxLevel >= level)))) || (this.spawn[0])); | |||
} | |||
} | |||
@@ -200,8 +200,10 @@ define([ | |||
clientMap.collisionMap = _.get2dArray(w, h); | |||
var startTemplate = startRoom.template; | |||
map.spawn.x = startRoom.x + ~~(startTemplate.width / 2); | |||
map.spawn.y = startRoom.y + ~~(startTemplate.height / 2); | |||
map.spawn = [{ | |||
x: startRoom.x + ~~(startTemplate.width / 2), | |||
y: startRoom.y + ~~(startTemplate.height / 2) | |||
}]; | |||
this.drawRoom(instance, startRoom); | |||
@@ -46,7 +46,7 @@ define([ | |||
var w = this.physics.width; | |||
var h = this.physics.height; | |||
var spawn = this.map.spawn; | |||
var spawn = this.map.spawn[0]; | |||
var x = null; | |||
var y = null; | |||