Просмотр исходного кода

moved custom channel code to socialCommands

tags/v0.1.7^2
Big Bad Waffle 6 лет назад
Родитель
Сommit
25eeca6a5a
6 измененных файлов: 30 добавлений и 7 удалений
  1. +2
    -1
      src/client/js/components/components.js
  2. +9
    -2
      src/client/ui/templates/messages/messages.js
  3. +3
    -1
      src/server/components/auth.js
  4. +10
    -0
      src/server/components/extensions/socialCommands.js
  5. +1
    -1
      src/server/components/player.js
  6. +5
    -2
      src/server/components/social.js

+ 2
- 1
src/client/js/components/components.js Просмотреть файл

@@ -30,7 +30,8 @@ var components = [
'trade',
'prophecies',
'reputation',
'serverActions'
'serverActions',
'social'
].map(function(c) {
return 'js/components/' + c;
});


+ 9
- 2
src/client/ui/templates/messages/messages.js Просмотреть файл

@@ -30,7 +30,8 @@ define([
this.onEvent('onGetMessages', this.onGetMessages.bind(this));
this.onEvent('onDoWhisper', this.onDoWhisper.bind(this));
this.onEvent('onJoinChannel', this.onJoinChannel.bind(this));
this.onEvent('onLeaveChannel', this.onJoinChannel.bind(this));
this.onEvent('onLeaveChannel', this.onLeaveChannel.bind(this));
this.onEvent('onGetCustomChatChannels', this.onGetCustomChatChannels.bind(this));

this.find('input')
.on('keydown', this.sendChat.bind(this))
@@ -45,6 +46,12 @@ define([
this.onEvent('onKeyDown', this.onKeyDown.bind(this));
},

onGetCustomChatChannels: function(channels) {
channels.forEach(function(c) {
this.onJoinChannel(c);
}, this);
},

onJoinChannel: function(channel) {
var container = this.find('.filters');
var newFilter = $(tplTab)
@@ -57,7 +64,7 @@ define([
},
onLeaveChannel: function(channel) {
this.hoverFilter = hover;
this.find('.filters [filter="' + channel + '"]').remove();
},

onFilterHover: function(hover) {


+ 3
- 1
src/server/components/auth.js Просмотреть файл

@@ -222,7 +222,9 @@ define([

onGetCustomChannels: function(data, character, result) {
this.customChannels = JSON.parse(result || '[]');

character.components.find(c => (c.type == 'social')).customChannels = this.customChannels;
if (this.customChannels != null)
data.callback(character);


+ 10
- 0
src/server/components/extensions/socialCommands.js Просмотреть файл

@@ -31,6 +31,11 @@ define([
roleLevel: null,

init: function(blueprint) {
if (this.customChannels) {
this.customChannels = this.customChannels
.filter((c, i) => (this.customChannels.indexOf(c) == i));
}

this.roleLevel = roles.getRoleLevel(this.obj);
},

@@ -133,6 +138,11 @@ define([
value: JSON.stringify(channels)
});

obj.socket.emit('event', {
event: 'onLeaveChannel',
data: value
});

this.obj.socket.emit('events', {
onGetMessages: [{
messages: [{


+ 1
- 1
src/server/components/player.js Просмотреть файл

@@ -66,7 +66,7 @@ define([
obj.addComponent('trade', character.components.find(c => c.type == 'trade'));
obj.addComponent('reputation', character.components.find(c => c.type == 'reputation'));

obj.addComponent('social');
obj.addComponent('social', character.components.find(c => c.type == 'social'));
obj.social.init();
obj.addComponent('aggro', {
faction: 'players'


+ 5
- 2
src/server/components/social.js Просмотреть файл

@@ -12,14 +12,17 @@ define([
partyLeaderId: null,
party: null,

init: function() {
customChannels: null,

init: function(blueprint) {
this.obj.extendComponent('social', 'socialCommands', {});
},

simplify: function() {
return {
type: 'social',
party: this.party
party: this.party,
customChannels: this.customChannels
};
},



Загрузка…
Отмена
Сохранить