Merge pull request #573 from Xelio/hook-playerNameResolved

New hook: playerNameResolved
This commit is contained in:
Jon Atkins
2013-10-28 10:45:53 -07:00
2 changed files with 9 additions and 1 deletions

View File

@ -74,9 +74,11 @@ window.resolvePlayerNames = function() {
window.playersInResolving = window.playersInResolving.concat(p);
postAjax('getPlayersByGuids', d, function(dat) {
var resolvedName = {};
if(dat.result) {
$.each(dat.result, function(ind, player) {
window.setPlayerName(player.guid, player.nickname);
resolvedName[player.guid] = player.nickname;
// remove from array
window.playersInResolving.splice(window.playersInResolving.indexOf(player.guid), 1);
});
@ -88,6 +90,9 @@ window.resolvePlayerNames = function() {
//therefore, not a good idea to automatically retry by adding back to the playersToResolve list
}
// Run hook 'playerNameResolved' with the resolved player names
window.runHooks('playerNameResolved', {names: resolvedName});
//TODO: have an event triggered for this instead of hard-coded single function call
if(window.selectedPortal)
window.renderPortalDetails(window.selectedPortal);