@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "isleward_client", | "name": "isleward_client", | ||||
"version": "0.13.0", | |||||
"version": "0.14.0", | |||||
"description": "isleward", | "description": "isleward", | ||||
"devDependencies": { | "devDependencies": { | ||||
@@ -222,7 +222,7 @@ define([ | |||||
this.find('.message').html(msg); | this.find('.message').html(msg); | ||||
}, | }, | ||||
onDeleteClick: function () { | |||||
onDeleteClick: async function () { | |||||
if (!this.selected) | if (!this.selected) | ||||
return; | return; | ||||
@@ -242,22 +242,34 @@ define([ | |||||
this.el.addClass('disabled'); | this.el.addClass('disabled'); | ||||
client.request({ | |||||
cpn: 'auth', | |||||
method: 'deleteCharacter', | |||||
data: { | |||||
name: this.selected | |||||
}, | |||||
callback: this.onGetCharacters.bind(this) | |||||
const result = await new Promise(res => { | |||||
client.request({ | |||||
cpn: 'auth', | |||||
method: 'deleteCharacter', | |||||
data: { | |||||
name: this.selected | |||||
}, | |||||
callback: res | |||||
}); | |||||
}); | }); | ||||
if (!result.success) { | |||||
this.setMessage(result.msg); | |||||
this.el.removeClass('disabled'); | |||||
return; | |||||
} | |||||
this.onGetCharacters(result.characterList); | |||||
}, | }, | ||||
onDeleteReset: function () { | onDeleteReset: function () { | ||||
this.setMessage(''); | |||||
this.deleteCount = 0; | this.deleteCount = 0; | ||||
this.find('.btnDelete') | this.find('.btnDelete') | ||||
.removeClass('deleting') | .removeClass('deleting') | ||||
.html('delete'); | .html('delete'); | ||||
setTimeout(this.setMessage.bind(this, ''), 5000); | |||||
} | } | ||||
}; | }; | ||||
}); | }); |
@@ -68,6 +68,8 @@ define([ | |||||
pos.top = e.detail.clientY; | pos.top = e.detail.clientY; | ||||
} | } | ||||
pos['max-height'] = window.innerHeight - pos.top - 10; | |||||
this.el | this.el | ||||
.css(pos) | .css(pos) | ||||
.show(); | .show(); | ||||
@@ -11,6 +11,7 @@ | |||||
color: @white; | color: @white; | ||||
text-align: center; | text-align: center; | ||||
line-height: 15px; | line-height: 15px; | ||||
overflow-y: auto; | |||||
.list { | .list { | ||||
width: 100%; | width: 100%; | ||||
@@ -358,8 +358,16 @@ define([ | |||||
if (isMobile) | if (isMobile) | ||||
this.hideTooltip(null, this.hoverItem); | this.hideTooltip(null, this.hoverItem); | ||||
const eBeforeShowItemContextMenu = { | |||||
sourceUi: 'inventory', | |||||
item: this.hoverItem, | |||||
ctxConfig | |||||
}; | |||||
events.emit('beforeShowItemContextMenu', eBeforeShowItemContextMenu); | |||||
if (ctxConfig.length > 0) | if (ctxConfig.length > 0) | ||||
events.emit('onContextMenu', ctxConfig, e); | |||||
events.emit('onContextMenu', eBeforeShowItemContextMenu.ctxConfig, e); | |||||
e.preventDefault(); | e.preventDefault(); | ||||
return false; | return false; | ||||
@@ -11,11 +11,11 @@ | |||||
</div> | </div> | ||||
<div class="message"></div> | <div class="message"></div> | ||||
</div> | </div> | ||||
<div class="news" location="https://gitlab.com/Isleward/play.isleward.com/-/wikis/v0.13.0-Release-Notes">[ Latest Release Notes ]</div> | |||||
<div class="news" location="https://gitlab.com/Isleward/play.isleward.com/-/wikis/v0.14.0-Release-Notes">[ Latest Release Notes ]</div> | |||||
<div class="extra"> | <div class="extra"> | ||||
<div class="el btn btnPatreon monetization" location="https://patreon.com/bigbadwaffle">Pledge on Patreon</div> | <div class="el btn btnPatreon monetization" location="https://patreon.com/bigbadwaffle">Pledge on Patreon</div> | ||||
<div class="el btn btnPaypal monetization" location="https://www.paypal.com/donate?hosted_button_id=NEQAV3NG9PWXA">Donate on Paypal</div> | <div class="el btn btnPaypal monetization" location="https://www.paypal.com/donate?hosted_button_id=NEQAV3NG9PWXA">Donate on Paypal</div> | ||||
<div class="el btn btnWiki" location="http://wiki.isleward.com/Main_Page">Access the Wiki</div> | <div class="el btn btnWiki" location="http://wiki.isleward.com/Main_Page">Access the Wiki</div> | ||||
</div> | </div> | ||||
<div class="version" location="https://gitlab.com/Isleward/play.isleward.com/-/wikis/v0.13.0-Release-Notes">v0.13.0</div> | |||||
<div class="version" location="https://gitlab.com/Isleward/play.isleward.com/-/wikis/v0.14.0-Release-Notes">v0.14.0</div> | |||||
</div> | </div> |
@@ -112,18 +112,6 @@ define([ | |||||
events.emit('onShowItemTooltip', item, ttPos, true); | events.emit('onShowItemTooltip', item, ttPos, true); | ||||
}, | }, | ||||
onClick: function (el, item) { | |||||
client.request({ | |||||
cpn: 'player', | |||||
method: 'performAction', | |||||
data: { | |||||
cpn: 'equipment', | |||||
method: 'equip', | |||||
data: item.id | |||||
} | |||||
}); | |||||
}, | |||||
onGetStashItems: function (items) { | onGetStashItems: function (items) { | ||||
this.items = items; | this.items = items; | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "isleward", | "name": "isleward", | ||||
"version": "0.13.0", | |||||
"version": "0.14.0", | |||||
"description": "isleward", | "description": "isleward", | ||||
"dependencies": { | "dependencies": { | ||||
@@ -547,6 +547,24 @@ module.exports = { | |||||
return; | return; | ||||
} | } | ||||
const msgBeforeDeleteCharacter = { | |||||
obj: this, | |||||
name: data.name, | |||||
success: true, | |||||
msg: null | |||||
}; | |||||
await eventEmitter.emit('beforeDeleteCharacter', msgBeforeDeleteCharacter); | |||||
if (!msgBeforeDeleteCharacter.success) { | |||||
msg.callback({ | |||||
success: false, | |||||
msg: msgBeforeDeleteCharacter.msg | |||||
}); | |||||
return; | |||||
} | |||||
await io.deleteAsync({ | await io.deleteAsync({ | ||||
key: data.name, | key: data.name, | ||||
table: 'character' | table: 'character' | ||||
@@ -576,7 +594,10 @@ module.exports = { | |||||
level: leaderboard.getLevel(c.name ? c.name : c) | level: leaderboard.getLevel(c.name ? c.name : c) | ||||
})); | })); | ||||
msg.callback(result); | |||||
msg.callback({ | |||||
success: true, | |||||
characterList: result | |||||
}); | |||||
}, | }, | ||||
permadie: function () { | permadie: function () { | ||||
@@ -15,7 +15,7 @@ module.exports = { | |||||
this.trigger.destroyed = true; | this.trigger.destroyed = true; | ||||
}, | }, | ||||
talk: function (msg) { | |||||
talk: async function (msg) { | |||||
if (!msg) | if (!msg) | ||||
return false; | return false; | ||||
@@ -41,7 +41,7 @@ module.exports = { | |||||
if ((target.trade) && (target.trade.faction)) | if ((target.trade) && (target.trade.faction)) | ||||
this.obj.reputation.discoverFaction(target.trade.faction.id); | this.obj.reputation.discoverFaction(target.trade.faction.id); | ||||
let state = target.dialogue.getState(this.obj, msg.state); | |||||
let state = await target.dialogue.getState(this.obj, msg.state); | |||||
if (!state) { | if (!state) { | ||||
this.obj.syncer.set(true, 'dialogue', 'state', null); | this.obj.syncer.set(true, 'dialogue', 'state', null); | ||||
return false; | return false; | ||||
@@ -54,7 +54,8 @@ module.exports = { | |||||
this.obj.syncer.set(true, 'dialogue', 'state', null); | this.obj.syncer.set(true, 'dialogue', 'state', null); | ||||
}, | }, | ||||
getState: function (sourceObj, state = 1) { | |||||
/* eslint-disable-next-line max-lines-per-function */ | |||||
getState: async function (sourceObj, state = 1) { | |||||
let result = null; | let result = null; | ||||
if ((state + '').indexOf('.') > -1) { | if ((state + '').indexOf('.') > -1) { | ||||
let config = this.states[(state + '').split('.')[0]]; | let config = this.states[(state + '').split('.')[0]]; | ||||
@@ -93,8 +94,9 @@ module.exports = { | |||||
if (stateConfig.goto) { | if (stateConfig.goto) { | ||||
if (result) | if (result) | ||||
return this.getState(sourceObj, stateConfig.goto.success); | |||||
return this.getState(sourceObj, stateConfig.goto.failure); | |||||
return await this.getState(sourceObj, stateConfig.goto.success); | |||||
return await this.getState(sourceObj, stateConfig.goto.failure); | |||||
} | } | ||||
if (result) { | if (result) { | ||||
useMsg = extend([], useMsg); | useMsg = extend([], useMsg); | ||||
@@ -102,7 +104,7 @@ module.exports = { | |||||
} else | } else | ||||
return null; | return null; | ||||
} else if (stateConfig.method) { | } else if (stateConfig.method) { | ||||
let methodResult = stateConfig.method.call(this.obj, sourceObj); | |||||
let methodResult = await stateConfig.method.call(this.obj, sourceObj); | |||||
if (methodResult) { | if (methodResult) { | ||||
useMsg = extend([], useMsg); | useMsg = extend([], useMsg); | ||||
useMsg[0].msg = methodResult; | useMsg[0].msg = methodResult; | ||||
@@ -283,6 +283,26 @@ module.exports = { | |||||
return result; | return result; | ||||
}, | }, | ||||
getTileIndexInAtlasSync: function (spriteSheet, tileIndexInSource) { | |||||
const { atlasTextures, atlasTextureDimensions } = config; | |||||
const indexOfSheet = atlasTextures.indexOf(spriteSheet); | |||||
let tileCountBeforeSheet = 0; | |||||
for (let i = 0; i < indexOfSheet; i++) { | |||||
const sheet = atlasTextures[i]; | |||||
const { width, height } = atlasTextureDimensions[sheet]; | |||||
tileCountBeforeSheet += ((width / 8) * (height / 8)); | |||||
} | |||||
//Tile index 0 is 'no tile' in map files so we need to increment by 1 | |||||
const result = tileCountBeforeSheet + tileIndexInSource + 1; | |||||
return result; | |||||
}, | |||||
//Used to send to clients | //Used to send to clients | ||||
getClientConfig: function (msg) { | getClientConfig: function (msg) { | ||||
msg.callback(config); | msg.callback(config); | ||||
@@ -1,7 +1,7 @@ | |||||
/* eslint-disable no-process-env */ | /* eslint-disable no-process-env */ | ||||
module.exports = { | module.exports = { | ||||
version: '0.13.0', | |||||
version: '0.14.0', | |||||
port: 4000, | port: 4000, | ||||
startupMessage: 'Server: ready', | startupMessage: 'Server: ready', | ||||
@@ -150,7 +150,7 @@ module.exports = { | |||||
}) | }) | ||||
.run(); | .run(); | ||||
} catch (e) { | } catch (e) { | ||||
this.logError({ | |||||
await this.logError({ | |||||
sourceModule: 'ioRethink', | sourceModule: 'ioRethink', | ||||
sourceMethod: 'setAsync', | sourceMethod: 'setAsync', | ||||
error: e, | error: e, | ||||
@@ -173,7 +173,7 @@ module.exports = { | |||||
.insert(value, { conflict }) | .insert(value, { conflict }) | ||||
.run(); | .run(); | ||||
} catch (e) { | } catch (e) { | ||||
this.logError({ | |||||
await this.logError({ | |||||
sourceModule: 'ioRethink', | sourceModule: 'ioRethink', | ||||
sourceMethod: 'setFlat', | sourceMethod: 'setFlat', | ||||
error: e, | error: e, | ||||
@@ -195,6 +195,16 @@ module.exports = { | |||||
.run(); | .run(); | ||||
}, | }, | ||||
deleteFilterAsync: async function ({ | |||||
table, | |||||
filter | |||||
}) { | |||||
await r.table(table) | |||||
.filter(filter) | |||||
.delete() | |||||
.run(); | |||||
}, | |||||
subscribe: function (table) { | subscribe: function (table) { | ||||
return r.table(table) | return r.table(table) | ||||
.changes() | .changes() | ||||
@@ -223,7 +233,7 @@ module.exports = { | |||||
}) | }) | ||||
.run(); | .run(); | ||||
} catch (e) { | } catch (e) { | ||||
this.logError({ | |||||
await this.logError({ | |||||
sourceModule: 'ioRethink', | sourceModule: 'ioRethink', | ||||
sourceMethod: 'append', | sourceMethod: 'append', | ||||
error: e, | error: e, | ||||
@@ -269,5 +279,7 @@ module.exports = { | |||||
}); | }); | ||||
} else | } else | ||||
process.exit(); | process.exit(); | ||||
throw new Error('Forcing crash'); | |||||
} | } | ||||
}; | }; |
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "isleward_server", | "name": "isleward_server", | ||||
"version": "0.13.0", | |||||
"version": "0.14.0", | |||||
"description": "isleward", | "description": "isleward", | ||||
"dependencies": { | "dependencies": { | ||||
"axios": "^0.22.0", | "axios": "^0.22.0", | ||||
@@ -1,4 +1,5 @@ | |||||
let herbs = require('../config/herbs'); | let herbs = require('../config/herbs'); | ||||
const eventEmitter = require('../misc/events'); | |||||
const defaultGatherChance = { | const defaultGatherChance = { | ||||
herb: 100, | herb: 100, | ||||
@@ -122,8 +123,20 @@ module.exports = { | |||||
}, | }, | ||||
spawn: function (node) { | spawn: function (node) { | ||||
let blueprint = node.blueprint; | |||||
let position = this.getRandomSpawnPosition(node, blueprint); | |||||
const blueprint = node.blueprint; | |||||
const eBeforeSpawnResource = { | |||||
node, | |||||
position: undefined, | |||||
allowRandomPosition: true | |||||
}; | |||||
eventEmitter.emit('beforeSpawnResource', eBeforeSpawnResource); | |||||
if (eBeforeSpawnResource.allowRandomPosition && !eBeforeSpawnResource.position) | |||||
eBeforeSpawnResource.position = this.getRandomSpawnPosition(node, blueprint); | |||||
const { position } = eBeforeSpawnResource; | |||||
if (!position) | if (!position) | ||||
return false; | return false; | ||||