Browse Source

initial commit

tags/v0.3.0
BigBadWaffle 5 years ago
parent
commit
6d4ef05f39
11 changed files with 61 additions and 90 deletions
  1. +4
    -0
      src/client/images/.directory
  2. +1
    -13
      src/client/js/main.js
  3. +4
    -15
      src/client/js/rendering/effects.js
  4. +21
    -0
      src/client/ui/factory.js
  5. +9
    -14
      src/client/ui/templates/equipment/equipment.js
  6. +8
    -21
      src/client/ui/templates/inventory/inventory.js
  7. +0
    -5
      src/client/ui/templates/inventory/templateTooltip.html
  8. +1
    -1
      src/client/ui/templates/login/login.js
  9. +0
    -1
      src/client/ui/templates/messages/messages.js
  10. +12
    -19
      src/client/ui/templates/stash/stash.js
  11. +1
    -1
      src/server/config/spells.js

+ 4
- 0
src/client/images/.directory View File

@@ -0,0 +1,4 @@
[Dolphin]
SortRole=type
Timestamp=2018,9,12,10,48,20
Version=4

+ 1
- 13
src/client/js/main.js View File

@@ -8,20 +8,8 @@ define([
'js/input',
'js/system/events',
'js/resources',
'ui/templates/inventory/inventory',
'ui/templates/equipment/equipment',
'ui/templates/stash/stash',
'ui/templates/hud/hud',
'ui/templates/online/online',
'ui/templates/quests/quests',
'ui/templates/events/events',
'ui/templates/dialogue/dialogue',
'ui/templates/smithing/smithing',
'ui/templates/overlay/overlay',
'ui/templates/tooltips/tooltips',
'ui/templates/reputation/reputation',
'ui/templates/death/death',
'ui/templates/passives/passives'
'ui/templates/tooltips/tooltips'
], function (
client,
uiFactory,


+ 4
- 15
src/client/js/rendering/effects.js View File

@@ -5,24 +5,13 @@ define([
) {
return {
list: [],
particles: [],
fog: [],

register: function (cpn) {
this.list.push(cpn);
},
unregister: function (cpn) {
let list = this.list;
let lLen = list.length;

for (let i = 0; i < lLen; i++) {
let l = list[i];

if (l === cpn) {
list.splice(i, 1);
return;
}
}
unregister: function (cpn) {
this.list.spliceWhere(l => l === cpn);
},

render: function () {
@@ -32,8 +21,8 @@ define([
for (let i = 0; i < lLen; i++) {
let l = list[i];

if ((l.destroyed) || (!l.obj) || (l.obj.destroyed)) {
if (((l.destroyManual) && (!l.destroyManual())) || (!l.destroyManual)) {
if (l.destroyed || !l.obj || l.obj.destroyed) {
if ((l.destroyManual && !l.destroyManual()) || !l.destroyManual) {
list.splice(i, 1);
i--;
lLen--;


+ 21
- 0
src/client/ui/factory.js View File

@@ -103,6 +103,27 @@ define([
$('.uiOverlay').hide();
},

preload: function () {
require([
'death',
'dialogue',
'equipment',
'events',
'hud',
'inventory',
'overlay',
'passives',
'quests',
'reputation',
'smithing',
'stash'
].map(m => 'ui/templates/' + m + '/' + m), this.afterPreload.bind(this));
},

afterPreload: function () {
this.build('characters', {});
},

update: function () {
let uis = this.uis;
let uLen = uis.length;


+ 9
- 14
src/client/ui/templates/equipment/equipment.js View File

@@ -2,12 +2,14 @@ define([
'js/system/events',
'js/system/client',
'html!ui/templates/equipment/template',
'css!ui/templates/equipment/styles'
'css!ui/templates/equipment/styles',
'js/input'
], function (
events,
client,
template,
styles
styles,
input
) {
return {
tpl: template,
@@ -22,7 +24,6 @@ define([
hoverItem: null,
hoverEl: null,
hoverCompare: null,
shiftDown: false,

isInspecting: false,

@@ -64,18 +65,12 @@ define([
onKeyDown: function (key) {
if (key === 'j')
this.toggle();
else if (key === 'shift') {
this.shiftDown = true;
if (this.hoverItem)
this.onHoverItem(this.hoverEl, this.hoverItem, this.hoverCompare);
}
else if (key === 'shift' && this.hoverItem)
this.onHoverItem(this.hoverEl, this.hoverItem, this.hoverCompare);
},
onKeyUp: function (key) {
if (key === 'shift') {
this.shiftDown = false;
if (this.hoverItem)
this.onHoverItem(this.hoverEl, this.hoverItem, null);
}
if (key === 'shift' && this.hoverItem)
this.onHoverItem(this.hoverEl, this.hoverItem, null);
},

onTabClick: function (e) {
@@ -329,7 +324,7 @@ define([
};
}

events.emit('onShowItemTooltip', item, ttPos, this.hoverCompare, false, this.shiftDown);
events.emit('onShowItemTooltip', item, ttPos, this.hoverCompare, false, input.isKeyDown('shift', true));
} else {
events.emit('onHideItemTooltip', this.hoverItem);
this.hoverItem = null;


+ 8
- 21
src/client/ui/templates/inventory/inventory.js View File

@@ -4,7 +4,6 @@ define([
'html!ui/templates/inventory/template',
'css!ui/templates/inventory/styles',
'html!ui/templates/inventory/templateItem',
'html!ui/templates/inventory/templateTooltip',
'js/input'
], function (
events,
@@ -12,7 +11,6 @@ define([
template,
styles,
tplItem,
tplTooltip,
input
) {
return {
@@ -22,9 +20,6 @@ define([

items: [],

shiftDown: false,
ctrlDown: false,

dragItem: null,
dragEl: null,
hoverCell: null,
@@ -143,7 +138,7 @@ define([
if (!msg.success)
return;

if (!this.ctrlDown)
if (!input.isKeyDown('ctrl', true))
return;

client.request({
@@ -398,7 +393,7 @@ define([
let delta = amount;
if (e)
delta = (e.originalEvent.deltaY > 0) ? -1 : 1;
if (this.shiftDown)
if (input.isKeyDown('shift', true))
delta *= 10;
let elAmount = this.find('.split-box .amount');

@@ -468,7 +463,7 @@ define([
});

// check special cases for mismatched weapon/offhand scenarios (only valid when comparing)
if ((!compare) && (this.shiftDown)) {
if (!compare && input.isKeyDown('shift', true)) {
let equippedTwoHanded = this.items.find(function (i) {
return ((i.eq) && (i.slot === 'twoHanded'));
});
@@ -523,7 +518,7 @@ define([
}
}

events.emit('onShowItemTooltip', item, ttPos, compare, false, this.shiftDown);
events.emit('onShowItemTooltip', item, ttPos, compare, false, input.isKeyDown('shift', true));
},

onGetItems: function (items, rerender) {
@@ -626,20 +621,12 @@ define([
onKeyDown: function (key) {
if (key === 'i')
this.toggle();
else if (key === 'shift') {
this.shiftDown = true;
if (this.hoverItem)
this.onHover();
} else if (key === 'ctrl')
this.ctrlDown = true;
else if (key === 'shift' && this.hoverItem)
this.onHover();
},
onKeyUp: function (key) {
if (key === 'shift') {
this.shiftDown = false;
if (this.hoverItem)
this.onHover();
} else if (key === 'ctrl')
this.ctrlDown = false;
if (key === 'shift' && this.hoverItem)
this.onHover();
}
};
});

+ 0
- 5
src/client/ui/templates/inventory/templateTooltip.html View File

@@ -1,5 +0,0 @@
<div class="name q$QUALITY$">$NAME$</div>
<div class="stats">$STATS$</div>
<div class="level">level: $LEVEL$</div>
<div class="material">crafting material</div>
<div class="info"><br />[shift] to compare</div>

+ 1
- 1
src/client/ui/templates/login/login.js View File

@@ -70,7 +70,7 @@ define([
this.el.removeClass('disabled');

if (!res) {
uiFactory.build('characters', {});
uiFactory.preload();

$('.uiLoginExtra').remove();
this.el.remove();


+ 0
- 1
src/client/ui/templates/messages/messages.js View File

@@ -23,7 +23,6 @@ define([

maxChatLength: 255,

shiftDown: false,
hoverItem: null,

hoverFilter: false,


+ 12
- 19
src/client/ui/templates/stash/stash.js View File

@@ -3,13 +3,15 @@ define([
'js/system/client',
'html!ui/templates/stash/template',
'css!ui/templates/stash/styles',
'html!ui/templates/inventory/templateItem'
'html!ui/templates/inventory/templateItem',
'js/input'
], function (
events,
client,
template,
styles,
tplItem
tplItem,
input
) {
return {
tpl: template,
@@ -17,8 +19,6 @@ define([
centered: true,
hoverItem: null,

shiftDown: false,

items: [],

modal: true,
@@ -121,11 +121,8 @@ define([
}

let compare = null;
if (this.shiftDown) {
compare = window.player.inventory.items.find(function (i) {
return ((i.eq) && (i.slot === item.slot));
});
}
if (input.isKeyDown('shift', true))
compare = window.player.inventory.items.find(i => (i.eq && i.slot === item.slot));

events.emit('onShowItemTooltip', item, ttPos, compare);
},
@@ -235,19 +232,15 @@ define([
onKeyDown: function (key) {
if (key === 'u')
this.toggle();
else if (key === 'shift') {
this.shiftDown = true;
if (this.hoverItem)
this.onHover();
} else if ((key === 'esc') && (this.shown))
else if (key === 'shift' && this.hoverItem)
this.onHover();
else if (key === 'esc' && this.shown)
this.toggle();
},

onKeyUp: function (key) {
if (key === 'shift') {
this.shiftDown = false;
if (this.hoverItem)
this.onHover();
}
if (key === 'shift' && this.hoverItem)
this.onHover();
}
};
});

+ 1
- 1
src/server/config/spells.js View File

@@ -290,7 +290,7 @@ let spells = [{
type: 'stealth',
icon: [2, 2]
},
/*, {
/*, {
name: 'Web Bolt',
description: 'Encases your target in webs, preventing them from doing anything for a short period',
type: 'cocoon',


Loading…
Cancel
Save