Skip to content

Commit 475b928

Browse files
committed
Fix Blink and Hex duplicates. Add complete victory condition. Add search for hero name.
1 parent a7be786 commit 475b928

16 files changed

+575
-19
lines changed

abilities.csv

Lines changed: 491 additions & 0 deletions
Large diffs are not rendered by default.

abilities.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

abilities.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ Nature's Guise
152152
Enrage
153153
Great Cleave
154154
Conjure Image
155-
Blink
155+
Blink (AM)
156+
Blink (QoP)
156157
Dual Breath
157158
Spell Steal
158159
Paralyzing Cask
@@ -405,7 +406,8 @@ Insatiable Hunger
405406
Mana Burn
406407
Blinding Light
407408
Ravage
408-
Hex
409+
Hex (Shaman)
410+
Hex (Lion)
409411
Crypt Swarm
410412
Storm Hammer
411413
Chilling Touch

abilityToHero.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from bs4 import BeautifulSoup
2+
import mechanize
3+
import re
4+
import urllib
5+
from hashlib import sha256
6+
7+
br = mechanize.Browser()
8+
br.set_handle_robots(False)
9+
br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1) \
10+
AppleWebKit/537.36 (KHTML, like Gecko) \
11+
Chrome/41.0.2228.0 Safari/537.36')]
12+
13+
out = open('abilities.csv', 'w')
14+
15+
def parseHero(heroLink):
16+
html = br.open(heroLink)
17+
soup = BeautifulSoup(html.read(), 'lxml')
18+
abilities = soup.find_all(lambda elem: elem.name == 'div' and 'style' in elem.attrs and 'flex: 0 1 450px' in elem.attrs['style'])
19+
for ability in abilities:
20+
# get the ability sound file
21+
btn = ability.find('a', title='Play', class_='sm2_button')
22+
if btn is None:
23+
continue
24+
25+
# get the name of the ability
26+
name = ability.div.get_text('|').split('|')[0]
27+
28+
if name == 'Cleave':
29+
continue
30+
if name == 'Aegis of the Immortal':
31+
continue
32+
33+
line = name + ',' + heroLink.split('/')[-1].replace('_', ' ') + '\n'
34+
print line
35+
out.write(line)
36+
37+
38+
html = br.open('http://dota2.gamepedia.com/Heroes')
39+
soup = BeautifulSoup(html.read(), 'lxml')
40+
heroes = soup.find_all('img', width=80, height=45)
41+
for hero in heroes:
42+
link = 'http://dota2.gamepedia.com' + hero.parent.attrs['href']
43+
parseHero(link)
Binary file not shown.
Binary file not shown.

css/d2sc.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ footer img {
156156
border-radius: 4px;
157157
background-color: #333;
158158
margin: 10px auto 10px auto;
159-
width: 300px;
159+
width: 320px;
160160
height: 50px;
161161
line-height: 50px;
162162
color: #eee;

getReducedAbilities.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import json
2+
3+
abilitiesList = [line.strip() for line in open('abilities.txt')]
4+
abilitiesDict = []
5+
6+
for line in open('abilities.csv'):
7+
ability, hero = line.strip().split(',')
8+
print(ability, hero)
9+
if ability in abilitiesList:
10+
abilitiesDict.append({'value': ability, 'hero': hero})
11+
12+
json.dump(abilitiesDict, open('abilities.json', 'w'))

img/icons/Blink (AM).png

21.9 KB
Loading

0 commit comments

Comments
 (0)