How to use the dotaconstants.cluster 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 / core / util / compute.js View on Github external
function computeMatchData(pm) {
  const selfHero = constants.heroes[pm.hero_id];
  // Compute patch based on start_time
  if (pm.start_time) {
    pm.patch = utility.getPatchIndex(pm.start_time);
  }
  if (pm.cluster) {
    pm.region = constants.cluster[pm.cluster];
  }
  if (pm.player_slot !== undefined && pm.radiant_win !== undefined) {
    pm.isRadiant = isRadiant(pm);
    pm.win = Number(isRadiant(pm) === pm.radiant_win);
    pm.lose = Number(isRadiant(pm) === pm.radiant_win) ? 0 : 1;
  }
  if (pm.duration && pm.gold_per_min) {
    pm.total_gold = Math.floor((pm.gold_per_min * pm.duration) / 60);
  }
  if (pm.duration && pm.xp_per_min) {
    pm.total_xp = Math.floor((pm.xp_per_min * pm.duration) / 60);
  }
  if (pm.duration && pm.kills) {
    pm.kills_per_min = pm.kills / (pm.duration / 60);
  }
  if (pm.kills !== undefined && pm.deaths !== undefined && pm.assists !== undefined) {