@@ -0,0 +1,18 @@ | |||||
define([ | |||||
], function( | |||||
) { | |||||
return { | |||||
roleLevel: null, | |||||
init: function(blueprint) { | |||||
this.roleLevel = blueprint.roleLevel; | |||||
}, | |||||
onBeforeChat: function(msg) { | |||||
console.log(msg.message); | |||||
msg.ignore = true; | |||||
} | |||||
}; | |||||
}); |
@@ -12,7 +12,14 @@ define([ | |||||
partyLeaderId: null, | partyLeaderId: null, | ||||
party: null, | party: null, | ||||
init: function() {}, | |||||
init: function() { | |||||
var roleLevel = roles.getRoleLevel(this.obj); | |||||
if (roleLevel >= 10) { | |||||
this.obj.extendComponent('social', 'adminCommands', { | |||||
roleLevel: roleLevel | |||||
}); | |||||
} | |||||
}, | |||||
simplify: function() { | simplify: function() { | ||||
return { | return { | ||||
@@ -68,6 +75,12 @@ define([ | |||||
}, | }, | ||||
chat: function(msg) { | chat: function(msg) { | ||||
if (this.onBeforeChat) { | |||||
this.onBeforeChat(msg.data); | |||||
if (msg.data.ignore) | |||||
return; | |||||
} | |||||
var charname = this.obj.auth.charname; | var charname = this.obj.auth.charname; | ||||
var level = this.obj.stats.values.level; | var level = this.obj.stats.values.level; | ||||
if (level >= 10) | if (level >= 10) | ||||
@@ -45,6 +45,13 @@ define([ | |||||
} | } | ||||
}, | }, | ||||
getRoleLevel: function(player) { | |||||
var account = player.account; | |||||
var level = this.accounts[account] ? this.accounts[account].level : 0; | |||||
return level; | |||||
}, | |||||
isRoleLevel: function(player, requireLevel, message) { | isRoleLevel: function(player, requireLevel, message) { | ||||
var account = player.account; | var account = player.account; | ||||
var level = this.accounts[account] ? this.accounts[account].level : 0; | var level = this.accounts[account] ? this.accounts[account].level : 0; | ||||