Antwort auf: partyboy@wob
ich habe eine Frage ich gebe dem User beim Login im Channel sich ein Getränk (nickIcon hinter dem Nick) zu nehmen nur wie bekomme ich es hin das der User sich nur eins auswählen darf .... und nicht alle Icons auf einmal hinter dem nick sind ?



Code:
User.prototype._addNicklistIconWithId = function _addNickListIconWithId(path, width, id) {
    var icons = this.getPersistence().getObject("nickIcons", {});
    if(typeof icons[id] != 'undefined') {
        this.removeNicklistIcon(icons[id]);
    }
    icons[id] = path;
    this.addNicklistIcon(path, width);
    this.getPersistence().setObject("nickIcons", icons);
};

User.prototype._removeNicklistIconById = function _removeNicklistIconById(id) {
    var icons = this.getPersistence().getObject("nickIcons", {});
    if(typeof icons[id] != 'undefined') {
        this.removeNicklistIcon(icons[id]);
    }
    delete icons[id];
    this.getPersistence().setObject("nickIcons", icons);
};



Diese Beiden Funktionen erlauben es Icons eine 'ID' zu geben die in der Persistenz landen. Sollte man ein zweites Icon mit der gleichen ID setzen, wird das andere Icon erst erntfernt.
_________________________
/apps install 30559674.ChannelMaster