<commit_before>var tswcalc = tswcalc || {};

tswcalc.slots = function() {
    //this method can only be called after the document is ready
    var init = function() {
        for (var i = 0; i < tswcalc.data.template_data.slots.length; i++) {
            var slotData = tswcalc.data.template_data.slots[i];
            this[slotData.id_prefix] = new tswcalc.slots.Slot(slotData.id_prefix, slotData.name, slotData.group);
            this[slotData.id_prefix].el.nameWarning.hide();
        }
    };

    var length = function() {
        return tswcalc.data.template_data.slots.length;
    };

    var indices = function() {
        return ['head', 'weapon', 'ring', 'neck', 'wrist', 'luck', 'waist', 'occult'];
    };

    var hasSlot = function(slot) {
        return this.hasOwnProperty(slot) && $.inArray(slot, indices()) != -1;
    };

    var reset = function() {
        for (var slotId in this) {
            if (this.hasSlot(slotId)) {
                this[slotId].reset();
            }
        }
    };

    var state = function() {
        var slotStates = {};
        for (var slotId in this) {
            if (this.hasSlot(slotId)) {
                slotStates[slotId] = this[slotId].state();
            }
        }
        return slotStates;
    };

    var mappedState = function() {
        var mappedSlotStates = {};
        for (var slotId in this) {
            if (this.hasSlot(slotId)) {
                mappedSlotStates[slotId] = this[slotId].mappedState();
            }
        }
        return mappedSlotStates;
    };

    var oPublic = {
        init: init,
        length: length,
        indices: indices,
        hasSlot: hasSlot,
        reset: reset,
        state: state,
        mappedState: mappedState
    };

    return oPublic;
}();

tswcalc.slots.Slot = function Slot(id, name, group) {
    var self = this;
    this.id = id;
    this.name = name;
    this.group = group;

    this.el = {
        name: $('#' + this.id + '-name'),
        role: $('#' + this.id + '-role'),
        ql: $('#' + this.id + '-ql'),
        glyphQl: $('#' + this.id + '-glyph-ql'),
        primaryGlyph: $('#' + this.id + '-primary-glyph'),
        secondaryGlyph: $('#' + this.id + '-secondary-glyph'),
        primaryDist: '#' + this.id + '-primary-glyph-dist > button.btn.active',
        secondaryDist: '#' + this.id + '-secondary-glyph-dist > button.btn.active',
        primaryGlyphValue: $('#' + this.id + '-primary-glyph-value'),
        secondaryGlyphValue: $('#' + this.id + '-secondary-glyph-value'),
        signetId: $('#' + this.id + '-pick-signet'),
        signetQuality: $('#' + this.id + '-signet-quality'),
        signetIconImg: $('#' + this.id + '-signet-img-icon'),
        signetIconBorderImg: $('#' + this.id + '-signet-img-quality'),
        signetDescription: $('#' + this.id + '-signet-description'),
        nameWarning: $('#' + this.id + '-name-warning'),
        btn: {
            primary: {
                0: $('#' + this.id + '-primary-glyph-dist-btn0'),
                1: $('#' + this.id + '-primary-glyph-dist-btn1'),
                2: $('#' + this.id + '-primary-glyph-dist-btn2'),
                3: $('#' + this.id + '-primary-glyph-dist-btn3'),
                4: $('#' + this.id + '-primary-glyph-dist-btn4')
            },
            secondary: {
                0: $('#' + this.id + '-secondary-glyph-dist-btn0'),
                1: $('#' + this.id + '-secondary-glyph-dist-btn1'),
                2: $('#' + this.id + '-secondary-glyph-dist-btn2'),
                3: $('#' + this.id + '-secondary-glyph-dist-btn3'),
                4: $('#' + this.id + '-secondary-glyph-dist-btn4')
            },
            nyraid: $('#' + this.id + '-nyraid')
        }
    };

    this.name = function() {
        if (arguments.length == 1) {
            this.el.name.html(arguments[0]);
        } else {
            return this.el.name.html();
        }
    };

    this.isWeapon = function() {
        return this.group == 'weapon' ? true : false;
    };

    this.role = function() {
        if (arguments.length == 1) {
            this.el.role.val(arguments[0]);
        } else {
            return this.group != 'weapon' ? this.el.role.val() : 'none';
        }
    };
<commit_msg>Added new el wtype and a setter/getter<commit_after>var tswcalc = tswcalc || {};

tswcalc.slots = function() {
    //this method can only be called after the document is ready
    var init = function() {
        for (var i = 0; i < tswcalc.data.template_data.slots.length; i++) {
            var slotData = tswcalc.data.template_data.slots[i];
            this[slotData.id_prefix] = new tswcalc.slots.Slot(slotData.id_prefix, slotData.name, slotData.group);
            this[slotData.id_prefix].el.nameWarning.hide();
        }
    };

    var length = function() {
        return tswcalc.data.template_data.slots.length;
    };

    var indices = function() {
        return ['head', 'weapon', 'ring', 'neck', 'wrist', 'luck', 'waist', 'occult'];
    };

    var hasSlot = function(slot) {
        return this.hasOwnProperty(slot) && $.inArray(slot, indices()) != -1;
    };

    var reset = function() {
        for (var slotId in this) {
            if (this.hasSlot(slotId)) {
                this[slotId].reset();
            }
        }
    };

    var state = function() {
        var slotStates = {};
        for (var slotId in this) {
            if (this.hasSlot(slotId)) {
                slotStates[slotId] = this[slotId].state();
            }
        }
        return slotStates;
    };

    var mappedState = function() {
        var mappedSlotStates = {};
        for (var slotId in this) {
            if (this.hasSlot(slotId)) {
                mappedSlotStates[slotId] = this[slotId].mappedState();
            }
        }
        return mappedSlotStates;
    };

    var oPublic = {
        init: init,
        length: length,
        indices: indices,
        hasSlot: hasSlot,
        reset: reset,
        state: state,
        mappedState: mappedState
    };

    return oPublic;
}();

tswcalc.slots.Slot = function Slot(id, name, group) {
    var self = this;
    this.id = id;
    this.name = name;
    this.group = group;

    this.el = {
        name: $('#' + this.id + '-name'),
        role: $('#' + this.id + '-role'),
        wtype: $('#' + this.id + '-wtype'),
        ql: $('#' + this.id + '-ql'),
        glyphQl: $('#' + this.id + '-glyph-ql'),
        primaryGlyph: $('#' + this.id + '-primary-glyph'),
        secondaryGlyph: $('#' + this.id + '-secondary-glyph'),
        primaryDist: '#' + this.id + '-primary-glyph-dist > button.btn.active',
        secondaryDist: '#' + this.id + '-secondary-glyph-dist > button.btn.active',
        primaryGlyphValue: $('#' + this.id + '-primary-glyph-value'),
        secondaryGlyphValue: $('#' + this.id + '-secondary-glyph-value'),
        signetId: $('#' + this.id + '-pick-signet'),
        signetQuality: $('#' + this.id + '-signet-quality'),
        signetIconImg: $('#' + this.id + '-signet-img-icon'),
        signetIconBorderImg: $('#' + this.id + '-signet-img-quality'),
        signetDescription: $('#' + this.id + '-signet-description'),
        nameWarning: $('#' + this.id + '-name-warning'),
        btn: {
            primary: {
                0: $('#' + this.id + '-primary-glyph-dist-btn0'),
                1: $('#' + this.id + '-primary-glyph-dist-btn1'),
                2: $('#' + this.id + '-primary-glyph-dist-btn2'),
                3: $('#' + this.id + '-primary-glyph-dist-btn3'),
                4: $('#' + this.id + '-primary-glyph-dist-btn4')
            },
            secondary: {
                0: $('#' + this.id + '-secondary-glyph-dist-btn0'),
                1: $('#' + this.id + '-secondary-glyph-dist-btn1'),
                2: $('#' + this.id + '-secondary-glyph-dist-btn2'),
                3: $('#' + this.id + '-secondary-glyph-dist-btn3'),
                4: $('#' + this.id + '-secondary-glyph-dist-btn4')
            },
            nyraid: $('#' + this.id + '-nyraid')
        }
    };

    this.name = function() {
        if (arguments.length == 1) {
            this.el.name.html(arguments[0]);
        } else {
            return this.el.name.html();
        }
    };

    this.isWeapon = function() {
        return this.group == 'weapon' ? true : false;
    };

    this.role = function() {
        if (arguments.length == 1) {
            this.el.role.val(arguments[0]);
        } else {
            return this.group != 'weapon' ? this.el.role.val() : 'none';
        }
    };

    this.wtype = function() {
        if (arguments.length == 1) {
            this.el.wtype.val(arguments[0]);
        } else {
            return this.group == 'weapon' ? this.el.wtype.val() : 'none';
        }
    };

{'fraction_non_alphanumeric': 0.18422252621979024, 'fraction_numerical': 0.006155950752393981, 'mean_word_length': 1.7683811928053013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4205216', 'n_tokens_mistral': 2798, 'n_tokens_neox': 2725, 'n_words': 521}