bug #2001: Fixed text rendering over emoji tags when the text is multiline.... See merge request Isleward/isleward!632tags/v0.13.0^0
@@ -1,5 +1,4 @@ | |||||
node_modules | node_modules | ||||
package-lock.json | |||||
*.css | *.css | ||||
storage.db | storage.db | ||||
@@ -17,9 +17,10 @@ audit: | |||||
lint-server: | lint-server: | ||||
stage: test | stage: test | ||||
script: | script: | ||||
- npm install eslint@7.32.0 eslint-plugin-prettier prettier babel-eslint eslint-plugin-requirejs | |||||
- cd src/server | |||||
- ../../node_modules/.bin/eslint . | |||||
- cd src | |||||
- npm install | |||||
- cd server | |||||
- ../node_modules/.bin/eslint . | |||||
only: | only: | ||||
- merge_requests | - merge_requests | ||||
- master | - master | ||||
@@ -27,9 +28,10 @@ lint-server: | |||||
lint-client: | lint-client: | ||||
stage: test | stage: test | ||||
script: | script: | ||||
- npm install eslint@7.32.0 eslint-plugin-prettier prettier babel-eslint eslint-plugin-requirejs | |||||
- cd src/client | |||||
- ../../node_modules/.bin/eslint . | |||||
- cd src | |||||
- npm install | |||||
- cd client | |||||
- ../node_modules/.bin/eslint . | |||||
only: | only: | ||||
- merge_requests | - merge_requests | ||||
- master | - master | ||||
@@ -1,3 +0,0 @@ | |||||
/client/plugins/* | |||||
node_modules/* | |||||
*.json |
@@ -220,7 +220,7 @@ | |||||
"no-throw-literal": 2, | "no-throw-literal": 2, | ||||
"no-undef": 1, | "no-undef": 1, | ||||
"no-undef-init": 2, | "no-undef-init": 2, | ||||
"no-underscore-dangle": 1, | |||||
"no-underscore-dangle": 0, | |||||
"no-unneeded-ternary": 2, | "no-unneeded-ternary": 2, | ||||
"no-unreachable": 1, | "no-unreachable": 1, | ||||
"no-unused-expressions": 2, | "no-unused-expressions": 2, | ||||
@@ -206,6 +206,14 @@ body { | |||||
color: @qualityLegendary; | color: @qualityLegendary; | ||||
} | } | ||||
.chat-style-white { | |||||
color: @white !important; | |||||
} | |||||
.chat-style-cyan { | |||||
color: @blueA !important; | |||||
} | |||||
.color-red { | .color-red { | ||||
color: @redB !important; | color: @redB !important; | ||||
} | } | ||||
@@ -11,7 +11,6 @@ define([ | |||||
'js/sound/sound', | 'js/sound/sound', | ||||
'js/system/globals', | 'js/system/globals', | ||||
'js/components/components', | 'js/components/components', | ||||
'ui/templates/online/online', | |||||
'ui/templates/tooltips/tooltips' | 'ui/templates/tooltips/tooltips' | ||||
], function ( | ], function ( | ||||
client, | client, | ||||
@@ -26,10 +26,7 @@ define([ | |||||
return callback; | return callback; | ||||
}, | }, | ||||
clearQueue: function () { | clearQueue: function () { | ||||
//Hack to allow the player list to persist | |||||
this.queue.spliceWhere(function (q) { | |||||
return ((q.event !== 'onGetConnectedPlayer') && (q.event !== 'onGetDisconnectedPlayer')); | |||||
}); | |||||
this.queue.length = 0; | |||||
}, | }, | ||||
off: function (eventName, callback) { | off: function (eventName, callback) { | ||||
let list = this.events[eventName] || []; | let list = this.events[eventName] || []; | ||||
@@ -0,0 +1,13 @@ | |||||
{ | |||||
"name": "isleward_client", | |||||
"version": "0.12.0", | |||||
"lockfileVersion": 2, | |||||
"requires": true, | |||||
"packages": { | |||||
"": { | |||||
"name": "isleward_client", | |||||
"version": "0.12.0", | |||||
"devDependencies": {} | |||||
} | |||||
} | |||||
} |
@@ -1,13 +1,8 @@ | |||||
{ | { | ||||
"name": "isleward_client", | "name": "isleward_client", | ||||
"version": "0.12.0", | |||||
"version": "0.13.0", | |||||
"description": "isleward", | "description": "isleward", | ||||
"dependencies": { | |||||
}, | |||||
"devDependencies": { | "devDependencies": { | ||||
"eslint": "^7.32.0", | |||||
"babel-eslint": "^10.1.0", | |||||
"eslint-plugin-prettier": "^3.4.0", | |||||
"eslint-plugin-requirejs": "^4.0.1" | |||||
} | } | ||||
} | } |
@@ -97,7 +97,7 @@ define([ | |||||
else | else | ||||
path = this.root + 'ui/templates/' + type + '/' + type; | path = this.root + 'ui/templates/' + type + '/' + type; | ||||
} | } | ||||
require([path], this.onGetTemplate.bind(this, options, type)); | require([path], this.onGetTemplate.bind(this, options, type)); | ||||
}, | }, | ||||
@@ -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.12.0-Release-Notes">[ Latest Release Notes ]</div> | |||||
<div class="news" location="https://gitlab.com/Isleward/play.isleward.com/-/wikis/v0.13.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.12.0-Release-Notes">v0.12.0</div> | |||||
<div class="version" location="https://gitlab.com/Isleward/play.isleward.com/-/wikis/v0.13.0-Release-Notes">v0.13.0</div> | |||||
</div> | </div> |
@@ -214,8 +214,8 @@ define([ | |||||
} | } | ||||
if (m.item) { | if (m.item) { | ||||
let source = message.split(':')[0]; | |||||
message = source + ': <span class="q' + (m.item.quality || 0) + '">' + message.replace(source + ': ', '') + '</span>'; | |||||
const [source, useMessage] = message.split(': {'); | |||||
message = source + ': <span class="q' + (m.item.quality || 0) + '"> {' + useMessage + '</span>'; | |||||
} | } | ||||
let el = $('<div class="list-message ' + m.class + '">' + message + '</div>') | let el = $('<div class="list-message ' + m.class + '">' + message + '</div>') | ||||
@@ -245,9 +245,9 @@ define([ | |||||
const isChannel = m?.subType === 'custom'; | const isChannel = m?.subType === 'custom'; | ||||
if (isChannel) { | if (isChannel) { | ||||
if (this.find('.filter[filter="' + m.channel + '"]').hasClass('active')) | if (this.find('.filter[filter="' + m.channel + '"]').hasClass('active')) | ||||
el.show(); | |||||
el.css({ display: 'flex' }); | |||||
else | else | ||||
el.hide(); | |||||
el.css({ display: 'none' }); | |||||
} | } | ||||
if (isMobile && ['loot', 'info'].indexOf(m.type) !== -1) { | if (isMobile && ['loot', 'info'].indexOf(m.type) !== -1) { | ||||
@@ -53,6 +53,7 @@ | |||||
.list-message { | .list-message { | ||||
display: none; | display: none; | ||||
justify-content: row; | |||||
width: 100%; | width: 100%; | ||||
padding: 5px 10px; | padding: 5px 10px; | ||||
color: white; | color: white; | ||||
@@ -64,7 +65,7 @@ | |||||
drop-shadow(0px 2px 0px @blackD) | drop-shadow(0px 2px 0px @blackD) | ||||
drop-shadow(2px 0px 0px @blackD) | drop-shadow(2px 0px 0px @blackD) | ||||
drop-shadow(-2px 0px 0px @blackD); | drop-shadow(-2px 0px 0px @blackD); | ||||
word-wrap: break-word; | |||||
word-wrap: anywhere; | |||||
line-height: 18px; | line-height: 18px; | ||||
&.q { | &.q { | ||||
@@ -111,19 +112,27 @@ | |||||
} | } | ||||
&.rep .rep { | &.rep .rep { | ||||
display: block; | |||||
display: flex; | |||||
} | } | ||||
&.chat .chat { | &.chat .chat { | ||||
display: block; | |||||
display: flex; | |||||
} | } | ||||
&.info .info { | &.info .info { | ||||
display: block; | |||||
display: flex; | |||||
} | } | ||||
&.loot .loot { | &.loot .loot { | ||||
display: block; | |||||
display: flex; | |||||
} | |||||
.emojiTag { | |||||
width: 24px; | |||||
height: 24px; | |||||
margin-top: -4px; | |||||
margin-right: 5px; | |||||
flex-shrink: 0; | |||||
} | } | ||||
} | } | ||||
@@ -1,177 +0,0 @@ | |||||
define([ | |||||
'js/system/events', | |||||
'js/system/client', | |||||
'js/system/globals', | |||||
'html!ui/templates/online/template', | |||||
'css!ui/templates/online/styles', | |||||
'html!ui/templates/online/templateListItem' | |||||
], function ( | |||||
events, | |||||
client, | |||||
globals, | |||||
template, | |||||
styles, | |||||
templateListItem | |||||
) { | |||||
return { | |||||
tpl: template, | |||||
centered: true, | |||||
onlineList: [], | |||||
modal: true, | |||||
hasClose: true, | |||||
actions: [], | |||||
postRender: function () { | |||||
globals.onlineList = this.onlineList; | |||||
this.onEvent('onGetConnectedPlayer', this.onGetConnectedPlayer.bind(this)); | |||||
this.onEvent('onGetDisconnectedPlayer', this.onGetDisconnectedPlayer.bind(this)); | |||||
this.onEvent('onGetSocialActions', this.onGetSocialActions.bind(this)); | |||||
this.onEvent('onKeyDown', this.onKeyDown.bind(this)); | |||||
this.onEvent('onShowOnline', this.toggle.bind(this)); | |||||
}, | |||||
onGetSocialActions: function (actions) { | |||||
this.actions = actions; | |||||
}, | |||||
onKeyDown: function (key) { | |||||
if (key === 'o') | |||||
this.toggle(); | |||||
}, | |||||
onAfterShow: function () { | |||||
this.build(); | |||||
}, | |||||
onGetConnectedPlayer: function (list) { | |||||
if (!list.length) | |||||
list = [list]; | |||||
let onlineList = this.onlineList; | |||||
list.forEach(function (l) { | |||||
let exists = onlineList.find(function (o) { | |||||
return (o.name === l.name); | |||||
}); | |||||
if (exists) | |||||
$.extend(true, exists, l); | |||||
else | |||||
onlineList.push(l); | |||||
}); | |||||
onlineList | |||||
.sort(function (a, b) { | |||||
if (a.level === b.level) { | |||||
if (a.name > b.name) | |||||
return 1; | |||||
return -1; | |||||
} return b.level - a.level; | |||||
}); | |||||
if (this.shown) | |||||
this.build(); | |||||
}, | |||||
onGetDisconnectedPlayer: function (playerName) { | |||||
let onlineList = this.onlineList; | |||||
onlineList.spliceWhere(function (o) { | |||||
return (o.name === playerName); | |||||
}); | |||||
if (this.shown) | |||||
this.build(); | |||||
}, | |||||
build: function () { | |||||
let headingText = this.el.find('.heading-text'); | |||||
let playerCount = this.onlineList.length; | |||||
headingText.html(`online players (${playerCount})`); | |||||
let container = this.el.find('.list'); | |||||
container | |||||
.children(':not(.heading)') | |||||
.remove(); | |||||
this.onlineList.forEach(function (l) { | |||||
let html = templateListItem | |||||
.replace('$NAME$', l.name) | |||||
.replace('$LEVEL$', l.level) | |||||
.replace('$CLASS$', l.class); | |||||
let el = $(html) | |||||
.appendTo(container) | |||||
.on('contextmenu', this.showContext.bind(this, l)); | |||||
if (isMobile) | |||||
el.on('mousedown', this.showContext.bind(this, l)); | |||||
}, this); | |||||
}, | |||||
showContext: function (char, e) { | |||||
if (char.name !== window.player.name) { | |||||
const extraActions = this.actions.map(({ command, text }) => { | |||||
return { | |||||
text, | |||||
callback: this.performAction.bind(this, command, char.name) | |||||
}; | |||||
}); | |||||
const isBlocked = window.player.social.isPlayerBlocked(char.name); | |||||
const actions = [{ | |||||
text: 'invite to party', | |||||
callback: this.invite.bind(this, char.id) | |||||
}, { | |||||
text: 'whisper', | |||||
callback: events.emit.bind(events, 'onDoWhisper', char.name) | |||||
}, { | |||||
text: isBlocked ? 'unblock' : 'block', | |||||
callback: this.block.bind(this, char.name) | |||||
}, ...extraActions]; | |||||
events.emit('onBeforeOnlineListContext', char.id, actions); | |||||
events.emit('onContextMenu', actions, e); | |||||
} | |||||
e.preventDefault(); | |||||
return false; | |||||
}, | |||||
performAction: function (command, charName) { | |||||
client.request({ | |||||
cpn: 'social', | |||||
method: 'chat', | |||||
data: { | |||||
message: `/${command} ${charName}` | |||||
} | |||||
}); | |||||
}, | |||||
block: function (charName) { | |||||
const isBlocked = window.player.social.isPlayerBlocked(charName); | |||||
let method = isBlocked ? 'unblock' : 'block'; | |||||
this.performAction(method, charName); | |||||
}, | |||||
invite: function (charId) { | |||||
this.hide(); | |||||
client.request({ | |||||
cpn: 'social', | |||||
method: 'getInvite', | |||||
data: { | |||||
targetId: charId | |||||
} | |||||
}); | |||||
} | |||||
}; | |||||
}); |
@@ -1,100 +0,0 @@ | |||||
@import "../../../css/colors.less"; | |||||
.uiOnline { | |||||
display: none; | |||||
background-color: @blackB; | |||||
border: 5px solid @blackB; | |||||
text-align: center; | |||||
width: 450px; | |||||
height: 396px; | |||||
> .heading { | |||||
color: @blueA; | |||||
width: 100%; | |||||
height: 36px; | |||||
background-color: @blackB; | |||||
.heading-text { | |||||
padding-top: 8px; | |||||
margin: auto; | |||||
} | |||||
} | |||||
.bottom { | |||||
height: calc(100% - 36px); | |||||
background-color: @blackC; | |||||
padding: 8px; | |||||
.list { | |||||
width: 100%; | |||||
height: 100%; | |||||
overflow-y: auto; | |||||
background-color: @blackC; | |||||
display: flex; | |||||
flex-direction: column; | |||||
.heading { | |||||
height: 24px; | |||||
color: @white; | |||||
> div { | |||||
float: left; | |||||
padding: 4px; | |||||
height: 24px; | |||||
&:nth-child(1) { | |||||
width: 10%; | |||||
} | |||||
&:nth-child(2) { | |||||
width: 55%; | |||||
} | |||||
&:nth-child(3) { | |||||
width: 35%; | |||||
} | |||||
} | |||||
} | |||||
.onlineUser { | |||||
color: @grayC; | |||||
height: 24px; | |||||
cursor: pointer; | |||||
> div { | |||||
float: left; | |||||
padding: 4px; | |||||
height: 24px; | |||||
&:nth-child(1) { | |||||
width: 10%; | |||||
} | |||||
&:nth-child(2) { | |||||
width: 55%; | |||||
} | |||||
&:nth-child(3) { | |||||
width: 35%; | |||||
} | |||||
} | |||||
&:hover { | |||||
background-color: @blackB; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
.mobile .uiOnline { | |||||
z-index: 2; | |||||
} |
@@ -1,14 +0,0 @@ | |||||
<div class="uiOnline hasBorderShadow"> | |||||
<div class="heading"> | |||||
<div class="heading-text">online players</div> | |||||
</div> | |||||
<div class="bottom"> | |||||
<div class="list"> | |||||
<div class="heading"> | |||||
<div class="col">level</div> | |||||
<div class="col">name</div> | |||||
<div class="col">spirit</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> |
@@ -1,5 +0,0 @@ | |||||
<div class="onlineUser"> | |||||
<div class="level">$LEVEL$</div> | |||||
<div class="name">$NAME$</div> | |||||
<div class>($CLASS$)</div> | |||||
</div> |
@@ -30,7 +30,7 @@ define([ | |||||
this.onEvent('onGetParty', this.onGetParty.bind(this)); | this.onEvent('onGetParty', this.onGetParty.bind(this)); | ||||
this.onEvent('onPartyDisband', this.onPartyDisband.bind(this)); | this.onEvent('onPartyDisband', this.onPartyDisband.bind(this)); | ||||
this.onEvent('onGetConnectedPlayer', this.onGetConnectedPlayer.bind(this)); | |||||
this.onEvent('globalObjectListUpdated', this.globalObjectListUpdated.bind(this)); | |||||
this.onEvent('onGetPartyStats', this.onGetPartyStats.bind(this)); | this.onEvent('onGetPartyStats', this.onGetPartyStats.bind(this)); | ||||
@@ -38,46 +38,34 @@ define([ | |||||
this.onTogglePartyView(config.partyView); | this.onTogglePartyView(config.partyView); | ||||
}, | }, | ||||
onGetConnectedPlayer: function (msg) { | |||||
globalObjectListUpdated: function ({ list }) { | |||||
if (!window.player) | if (!window.player) | ||||
return; | return; | ||||
const { party } = this; | const { party } = this; | ||||
const { player: { serverId: playerId, zoneId: playerZone } } = window; | |||||
const { player: { serverId: playerId } } = window; | |||||
const player = list.find(l => l.id === playerId); | |||||
const { zoneId: playerZone } = player; | |||||
if (!party) | if (!party) | ||||
return; | return; | ||||
if (!(msg instanceof Array)) | |||||
msg = [msg]; | |||||
msg.forEach(m => { | |||||
const { id: mId, zoneId: mZone } = m; | |||||
list.forEach(l => { | |||||
const { id: mId, zoneId: mZone, level: mLevel } = l; | |||||
if (!party.includes(m.id)) | |||||
if (!party.includes(mId)) | |||||
return; | return; | ||||
if (mId !== playerId) { | if (mId !== playerId) { | ||||
const el = this.find('.member[memberId="' + m.id + '"]'); | |||||
const el = this.find('.member[memberId="' + mId + '"]'); | |||||
el.removeClass('differentZone'); | el.removeClass('differentZone'); | ||||
if (m.zoneId !== playerZone) | |||||
if (mZone !== playerZone) | |||||
el.addClass('differentZone'); | el.addClass('differentZone'); | ||||
el.find('.txtLevel').html('level: ' + m.level); | |||||
return; | |||||
el.find('.txtLevel').html('level: ' + mLevel); | |||||
} | } | ||||
party.forEach(p => { | |||||
const mObj = globals.onlineList.find(o => o.id === p); | |||||
const el = this.find('.member[memberId="' + p + '"]'); | |||||
el.removeClass('differentZone'); | |||||
if (mObj.zoneId !== mZone) | |||||
el.addClass('differentZone'); | |||||
}); | |||||
}); | }); | ||||
}, | }, | ||||
@@ -0,0 +1,14 @@ | |||||
{ | |||||
"name": "isleward", | |||||
"version": "0.13.0", | |||||
"description": "isleward", | |||||
"dependencies": { | |||||
}, | |||||
"devDependencies": { | |||||
"babel-eslint": "^10.1.0", | |||||
"eslint": "7.32.0", | |||||
"eslint-plugin-prettier": "4.0.0", | |||||
"eslint-plugin-requirejs": "^4.0.1" | |||||
} | |||||
} |
@@ -1,2 +1,2 @@ | |||||
node_modules/* | node_modules/* | ||||
config/passiveTree.js | |||||
config/passiveTree.js |
@@ -306,7 +306,20 @@ | |||||
"overrides": [ | "overrides": [ | ||||
{ | { | ||||
"files": [ | "files": [ | ||||
"**/clientComponents/**/*.js" | |||||
"clientComponents/**/*" | |||||
], | |||||
"extends": "../client/.eslintrc" | |||||
}, | |||||
{ | |||||
"files": [ | |||||
"mods/**/ui/*", | |||||
"mods/**/clientComponents/**/*" | |||||
], | |||||
"extends": "../client/.eslintrc" | |||||
}, | |||||
{ | |||||
"files": [ | |||||
"mods/**/ui/**/*" | |||||
], | ], | ||||
"extends": "../client/.eslintrc" | "extends": "../client/.eslintrc" | ||||
} | } | ||||
@@ -263,19 +263,8 @@ module.exports = { | |||||
let itemId = eq[slot]; | let itemId = eq[slot]; | ||||
let item = inventory.findItem(itemId); | let item = inventory.findItem(itemId); | ||||
if (!item) { | |||||
console.log({ | |||||
error: 'item not found', | |||||
itemId, | |||||
slot, | |||||
factionId, | |||||
tier, | |||||
character: this.obj.name, | |||||
eq: this.eq | |||||
}); | |||||
if (!item) | |||||
return; | return; | ||||
} | |||||
let factions = item.factions; | let factions = item.factions; | ||||
if (!factions) | if (!factions) | ||||
@@ -107,35 +107,13 @@ module.exports = { | |||||
atlas.addObject(this.obj, true); | atlas.addObject(this.obj, true); | ||||
cons.emit('events', { | |||||
onGetMessages: [{ | |||||
messages: [{ | |||||
class: 'color-blueB', | |||||
message: this.obj.name + ' has come online' | |||||
}] | |||||
}], | |||||
onGetConnectedPlayer: [cons.getCharacterList()] | |||||
eventEmitter.emit('playerObjAdded', { | |||||
obj | |||||
}); | }); | ||||
cb(); | cb(); | ||||
}, | }, | ||||
broadcastSelf: function () { | |||||
let obj = this.obj; | |||||
let self = { | |||||
id: obj.id, | |||||
zoneId: obj.zoneId, | |||||
name: obj.name, | |||||
level: obj.level, | |||||
class: obj.class | |||||
}; | |||||
cons.emit('events', { | |||||
onGetConnectedPlayer: [self] | |||||
}); | |||||
}, | |||||
hasSeen: function (id) { | hasSeen: function (id) { | ||||
return (this.seen.indexOf(id) > -1); | return (this.seen.indexOf(id) > -1); | ||||
}, | }, | ||||
@@ -63,8 +63,8 @@ module.exports = { | |||||
}); | }); | ||||
}, | }, | ||||
chat: function (msg) { | |||||
chat(this, msg); | |||||
chat: async function (msg) { | |||||
await chat(this, msg); | |||||
}, | }, | ||||
dc: function () { | dc: function () { | ||||
@@ -2,24 +2,42 @@ const events = require('../../misc/events'); | |||||
const profanities = require('../../misc/profanities'); | const profanities = require('../../misc/profanities'); | ||||
const canChat = require('./canChat'); | const canChat = require('./canChat'); | ||||
const sendRegularMessage = ({ obj }, msg) => { | |||||
const sendRegularMessage = async ({ obj }, msg) => { | |||||
const charname = obj.auth.charname; | const charname = obj.auth.charname; | ||||
const msgEvent = { | const msgEvent = { | ||||
username: obj.account, | username: obj.account, | ||||
tagPrefix: '(', | |||||
tagSuffix: ')', | |||||
tagPrefix: null, | |||||
tagSuffix: null, | |||||
tags: [], | tags: [], | ||||
msgStyle: 'color-grayB' | |||||
emojiTag: null, | |||||
namePrefix: '', | |||||
nameSuffix: '', | |||||
msgStyle: null, | |||||
obj | |||||
}; | }; | ||||
events.emit('onBeforeGetChatStyles', msgEvent); | |||||
await events.emit('onBeforeGetChatStyles', msgEvent); | |||||
const { emojiTag } = msgEvent; | |||||
let usePrefix = ''; | let usePrefix = ''; | ||||
if (msgEvent.tags.length) | |||||
if (emojiTag) { | |||||
const imgX = (-emojiTag.sprite[0] * emojiTag.spriteSize); | |||||
const imgY = (-emojiTag.sprite[1] * emojiTag.spriteSize); | |||||
const backgroundPosition = `${imgX}px ${imgY}px`; | |||||
usePrefix = `<div class='emojiTag' style='background: url("${emojiTag.spritesheet}") no-repeat scroll ${backgroundPosition} / auto;'></div>`; | |||||
} else if (msgEvent.tags.length > 0) | |||||
usePrefix = `${msgEvent.tagPrefix}${msgEvent.tags.join(' ')}${msgEvent.tagSuffix} `; | usePrefix = `${msgEvent.tagPrefix}${msgEvent.tags.join(' ')}${msgEvent.tagSuffix} `; | ||||
const finalMessage = `${usePrefix}${charname}: ${msg.data.message}`; | |||||
let useCharName = charname; | |||||
if (msgEvent.namePrefix) | |||||
useCharName = `${msgEvent.namePrefix}${useCharName}`; | |||||
if (msgEvent.nameSuffix) | |||||
useCharName = `${useCharName}${msgEvent.nameSuffix}`; | |||||
const finalMessage = `${usePrefix}${useCharName}: ${msg.data.message}`; | |||||
const item = msg.data.item ? JSON.parse(JSON.stringify(msg.data.item).replace(/(<([^>]+)>)/ig, '')) : undefined; | const item = msg.data.item ? JSON.parse(JSON.stringify(msg.data.item).replace(/(<([^>]+)>)/ig, '')) : undefined; | ||||
@@ -27,7 +45,7 @@ const sendRegularMessage = ({ obj }, msg) => { | |||||
event: 'onGetMessages', | event: 'onGetMessages', | ||||
data: { | data: { | ||||
messages: [{ | messages: [{ | ||||
class: msgEvent.msgStyle, | |||||
class: msgEvent.msgStyle ?? 'color-grayB', | |||||
message: finalMessage, | message: finalMessage, | ||||
item, | item, | ||||
type: 'chat', | type: 'chat', | ||||
@@ -157,7 +175,7 @@ const sendErrorMsg = (cpnSocial, msgString) => { | |||||
cpnSocial.sendMessage(msgString, 'color-redA'); | cpnSocial.sendMessage(msgString, 'color-redA'); | ||||
}; | }; | ||||
module.exports = (cpnSocial, msg) => { | |||||
module.exports = async (cpnSocial, msg) => { | |||||
const { data: msgData } = msg; | const { data: msgData } = msg; | ||||
if (!msgData.message) | if (!msgData.message) | ||||
@@ -246,5 +264,5 @@ module.exports = (cpnSocial, msg) => { | |||||
if (!messageHandler) | if (!messageHandler) | ||||
return; | return; | ||||
messageHandler(cpnSocial, msg); | |||||
await messageHandler(cpnSocial, msg); | |||||
}; | }; |
@@ -266,7 +266,7 @@ module.exports = { | |||||
let targetTrade = target.trade; | let targetTrade = target.trade; | ||||
const item = this.obj.inventory.findItem(msg.itemId); | const item = this.obj.inventory.findItem(msg.itemId); | ||||
if (!item) | |||||
if (!item || item.worth <= 0 || item.eq || item.noDestroy) | |||||
return; | return; | ||||
const oldQuantity = item.quantity; | const oldQuantity = item.quantity; | ||||
@@ -312,7 +312,7 @@ module.exports = { | |||||
this.target = target; | this.target = target; | ||||
let itemList = this.obj.inventory.items | let itemList = this.obj.inventory.items | ||||
.filter(i => ((i.worth > 0) && (!i.eq))); | |||||
.filter(i => i.worth > 0 && !i.eq && !i.noDestroy); | |||||
itemList = extend([], itemList); | itemList = extend([], itemList); | ||||
this.obj.syncer.set(true, 'trade', 'sellList', { | this.obj.syncer.set(true, 'trade', 'sellList', { | ||||
@@ -1,7 +1,7 @@ | |||||
/* eslint-disable no-process-env */ | /* eslint-disable no-process-env */ | ||||
module.exports = { | module.exports = { | ||||
version: '0.12.0', | |||||
version: '0.13.0', | |||||
port: 4000, | port: 4000, | ||||
startupMessage: 'Server: ready', | startupMessage: 'Server: ready', | ||||
@@ -1,3 +1,5 @@ | |||||
const eventEmitter = require('../misc/events'); | |||||
let objBase = require('./objBase'); | let objBase = require('./objBase'); | ||||
module.exports = { | module.exports = { | ||||
@@ -305,8 +307,11 @@ module.exports = { | |||||
class: 'color-blueB', | class: 'color-blueB', | ||||
message: player.name + ' has reached level ' + obj.level | message: player.name + ' has reached level ' + obj.level | ||||
}] | }] | ||||
}], | |||||
onGetConnectedPlayer: [cons.getCharacterList()] | |||||
}] | |||||
}); | |||||
eventEmitter.emit('playerObjChanged', { | |||||
obj: player | |||||
}); | }); | ||||
} | } | ||||
}, | }, | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "isleward_server", | "name": "isleward_server", | ||||
"version": "0.12.0", | |||||
"version": "0.13.0", | |||||
"description": "isleward", | "description": "isleward", | ||||
"dependencies": { | "dependencies": { | ||||
"axios": "^0.22.0", | "axios": "^0.22.0", | ||||
@@ -15,10 +15,6 @@ | |||||
"universal-analytics": "^0.5.1" | "universal-analytics": "^0.5.1" | ||||
}, | }, | ||||
"devDependencies": { | "devDependencies": { | ||||
"babel-eslint": "^10.1.0", | |||||
"eslint": "^7.32.0", | |||||
"eslint-plugin-prettier": "^4.0.0", | |||||
"eslint-plugin-requirejs": "^4.0.1", | |||||
"sqlite3": "^5.0.3" | "sqlite3": "^5.0.3" | ||||
} | } | ||||
} | } |
@@ -1,5 +1,6 @@ | |||||
//External Modules | //External Modules | ||||
const objects = require('../objects/objects'); | const objects = require('../objects/objects'); | ||||
const eventEmitter = require('../misc/events'); | |||||
//Helpers | //Helpers | ||||
const { route, routeGlobal } = require('./connections/route'); | const { route, routeGlobal } = require('./connections/route'); | ||||
@@ -56,14 +57,8 @@ module.exports = { | |||||
} | } | ||||
if (player.name) { | if (player.name) { | ||||
this.emit('events', { | |||||
onGetMessages: [{ | |||||
messages: [{ | |||||
class: 'color-blueB', | |||||
message: player.name + ' has gone offline' | |||||
}] | |||||
}], | |||||
onGetDisconnectedPlayer: [player.name] | |||||
eventEmitter.emit('playerObjRemoved', { | |||||
id: player.id | |||||
}); | }); | ||||
if (player.has('id')) | if (player.has('id')) | ||||
@@ -107,14 +102,8 @@ module.exports = { | |||||
} | } | ||||
}); | }); | ||||
this.emit('events', { | |||||
onGetMessages: [{ | |||||
messages: [{ | |||||
class: 'color-blueB', | |||||
message: player.name + ' has gone offline' | |||||
}] | |||||
}], | |||||
onGetDisconnectedPlayer: [player.name] | |||||
eventEmitter.emit('playerObjRemoved', { | |||||
id: player.id | |||||
}); | }); | ||||
//If we don't do this, the atlas will try to remove it from the thread | //If we don't do this, the atlas will try to remove it from the thread | ||||
@@ -9,7 +9,6 @@ const appRoot = (req, res) => { | |||||
const appFile = (req, res) => { | const appFile = (req, res) => { | ||||
let root = req.url.split('/')[1]; | let root = req.url.split('/')[1]; | ||||
let file = req.params[0]; | let file = req.params[0]; | ||||
file = file.replace('/' + root + '/', ''); | file = file.replace('/' + root + '/', ''); | ||||
const validRequest = ( | const validRequest = ( | ||||
@@ -56,7 +56,9 @@ module.exports = { | |||||
serverObj.zoneId = thread.id; | serverObj.zoneId = thread.id; | ||||
serverObj.zoneName = thread.name; | serverObj.zoneName = thread.name; | ||||
serverObj.player.broadcastSelf(); | |||||
events.emit('playerObjChanged', { | |||||
obj | |||||
}); | |||||
const simpleObj = obj.getSimple ? obj.getSimple(true, true) : obj; | const simpleObj = obj.getSimple ? obj.getSimple(true, true) : obj; | ||||