Browse Source

fixes #1324

tags/v0.4.2^2
Big Bad Waffle 4 years ago
parent
commit
5656f1e87a
2 changed files with 19 additions and 9 deletions
  1. +15
    -5
      src/client/ui/templates/hud/hud.js
  2. +4
    -4
      src/server/config/maps/sewer/events/plagueOfRats.js

+ 15
- 5
src/client/ui/templates/hud/hud.js View File

@@ -15,12 +15,18 @@ define([
stats: null,
items: null,

quickItem: null,

postRender: function () {
this.onEvent('onGetStats', this.events.onGetStats.bind(this));
this.onEvent('onGetPortrait', this.events.onGetPortrait.bind(this));
this.onEvent('onGetItems', this.events.onGetItems.bind(this));
this.onEvent('onDestroyItems', this.events.onDestroyItems.bind(this));
this.onEvent('onKeyDown', this.events.onKeyDown.bind(this));

this.find('.quickItem')
.on('mousemove', this.showQuickItemTooltip.bind(this, true))
.on('mouseleave', this.showQuickItemTooltip.bind(this, false));
},

build: function () {
@@ -61,7 +67,9 @@ define([
});
},

showQuickItemTooltip: function (show, item, e) {
showQuickItemTooltip: function (show, e) {
const item = this.quickItem;

if (show) {
let ttPos = null;
if (e) {
@@ -112,6 +120,7 @@ define([
this.items = items;

const quickItem = items.find(f => f.has('quickSlot'));
this.quickItem = quickItem;
if (!quickItem) {
const oldQuickItem = this.find('.quickItem').data('item');
if (oldQuickItem)
@@ -132,13 +141,14 @@ define([
let imgX = -quickItem.sprite[0] * 64;
let imgY = -quickItem.sprite[1] * 64;

let el = this.find('.quickItem').show();
const el = this.find('.quickItem').show();
if (el.data('item') && el.data('item').id === quickItem.id)
return;

el
.data('item', quickItem)
.find('.icon')
.css('background', 'url("' + spritesheet + '") ' + imgX + 'px ' + imgY + 'px')
.on('mousemove', this.showQuickItemTooltip.bind(this, true, quickItem))
.on('mouseleave', this.showQuickItemTooltip.bind(this, false, quickItem));
.css('background', 'url("' + spritesheet + '") ' + imgX + 'px ' + imgY + 'px');
},

onKeyDown: function (key) {


+ 4
- 4
src/server/config/maps/sewer/events/plagueOfRats.js View File

@@ -6,10 +6,10 @@ Todo:
*/

const descriptionStrings = {
leadup: 'A bandit alchemist has been spotted in the sewer tunnels',
active: 'Rats are swarming towards the city',
success: 'Success: The rat invasion has been averted',
failure: 'Failure: The rats have made it to the city',
leadup: 'A bandit alchemist has been spotted in the sewer tunnels.',
active: 'Rats are swarming towards the city.',
success: 'Success: The rat invasion has been averted.',
failure: 'Failure: The rats have made it to the city.',
escapeCounter: 'Escapees: $ratEscapees$'
};



Loading…
Cancel
Save