Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Dota 2: Fixes #3296 Skeleton King Trigger not working (#3341)
Browse files Browse the repository at this point in the history
* Dota 2: Fixes #3296 Skeleton King Trigger not working

* Issue #3296: Changes split and join to replace
  • Loading branch information
manrajgrover authored and moollaza committed Sep 6, 2017
1 parent 2da80b2 commit df59c3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions share/spice/dota2/dota2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

function getItemFromData(itemdata, itemName) {
var item;

if (itemdata[itemName]) {
item = itemdata[itemName];
} else {
Expand Down Expand Up @@ -83,6 +84,7 @@

function getHeroFromData(herodata, heroName) {
var hero;

if (herodata[heroName]) {
hero = herodata[heroName];
hero.heroKey = heroName;
Expand Down Expand Up @@ -179,10 +181,12 @@
}

var searchTarget = DDG.get_query().toLowerCase().replace(/dota\s?2/, "").trim();
var keyTarget = searchTarget.replace(' ', '_');
var returnData;
var item = getItemFromData(api_result.itemdata, searchTarget);
var item = getItemFromData(api_result.itemdata, keyTarget);
var sourceUrl;
var template;

if (typeof item !== 'undefined') {
returnData = createItemReturnObject(item, api_result);
sourceUrl = 'https://www.dota2.com/items/';
Expand All @@ -193,7 +197,7 @@
}
};
} else {
var hero = getHeroFromData(api_result.herodata, searchTarget);
var hero = getHeroFromData(api_result.herodata, keyTarget);
if (!hero) { return Spice.failed('dota2'); }

returnData = createHeroReturnObject(hero, api_result);
Expand Down

0 comments on commit df59c3e

Please sign in to comment.