How to use the dotaconstants/build/ability_ids.json.hasOwnProperty function in dotaconstants

To help you get started, we’ve selected a few dotaconstants examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github odota / mobile / devUtils / generateAbilitiesImageGetter.js View on Github external
var abilities = require('dotaconstants/build/ability_ids.json');
var fs = require('fs');
var _ = require('lodash');

var data = "export function getAbilityImage(id) {\n\tvar staticImage;\n";

for(var key in abilities) {
    if(abilities.hasOwnProperty(key)) {
        if(abilities[key].includes("special_bonus")) {
            var newLine = "\t} else if (id == " + key + ") {\n\t\tstaticImage = require('../assets/talent_tree.png');\n"
            data += newLine;
        } else {
            var newLine = "\t} else if (id == " + key + ") {\n\t\tstaticImage = require('../assets/abilities/" + abilities[key] + "_lg.png');\n"
            data += newLine;
        }
    }
}

data += "\t}\n\t return staticImage;\n}"

fs.writeFile("../app/utils/getAbilityImage.js", data, function(err) {
    if(err) {
        console.log(err);
    } else {
github odota / mobile / app / containers / MatchPerformance.js View on Github external
getAbilityId(abilityName) {
        for(var key in abilities) {
            if(abilities.hasOwnProperty(key)) {
                if(abilities[key] == abilityName) {
                    return key;
                }
            }
        }
    }