-
Notifications
You must be signed in to change notification settings - Fork 16
/
w3g.py
executable file
·2695 lines (2426 loc) · 91.6 KB
/
w3g.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""Implements the basic w3g file class. Based on information available at
* http://w3g.deepnode.de/files/w3g_format.txt
:author: scopz <[email protected]>
"""
from __future__ import unicode_literals, print_function
import io
import sys
import base64
import zlib
import struct
import binascii
from collections import namedtuple
__version__ = '1.0.5'
WORD = 2 # bytes
DWORD = 4 # bytes, double word
NULLSTR = b'\0'
MAXPOS = 16384.0 # maps may range from -MAXPOS to MAXPOS with (0, 0) at the center
# build number associated with v1.07 of the game
BUILD_1_06 = 4656
# build number associated with v1.07 of the game
BUILD_1_07 = 6031
# build number associated with v1.13 of the game
BUILD_1_13 = 6037
# build number associated with v1.14b of the game
BUILD_1_14B = 6040
if sys.version_info[0] < 3:
BLENFLAG = {1: 'B', WORD: 'H', DWORD: 'L', 8: 'Q'}
b2i = lambda b: struct.unpack('<' + BLENFLAG[len(b)], b)[0]
# to print unicode
import codecs
UTF8Writer = codecs.getwriter('utf8')
utf8writer = UTF8Writer(sys.stdout)
def umake(f):
def uprint(*objects, **kw):
uo = map(unicode, objects)
if 'file' not in kw:
kw['file'] = utf8writer
f(*uo, **kw)
return uprint
print = umake(print)
# fake lru_cache
lru_cache = lambda maxsize=128, typed=False: lambda f: f
else:
b2i = lambda b: b if isinstance(b, int) else int.from_bytes(b, 'little')
from functools import lru_cache
def nulltermstr(b):
"""Returns the next null terminated string from bytes and its length."""
i = b.find(NULLSTR)
try:
s = b[:i].decode('utf-8')
except:
s = b[:i].decode('latin-1')
return s, i
def fixedlengthstr(b, i):
"""Returns a string of length i from bytes"""
s = b[:i].decode('utf-8')
return s
def blizdecomp(b):
"""Performs wacky blizard 'decompression' and returns bytes and len in
original string.
"""
if isinstance(b, str):
b = list(map(b2i, b))
d = []
pos = 0
mask = None
while b[pos] != 0:
if pos%8 == 0:
mask = b[pos]
elif ((mask & (0x1 << (pos%8))) == 0):
d.append(b[pos] - 1)
else:
d.append(b[pos])
pos += 1
if bytes == str:
d = b''.join(map(chr, d))
else:
d = bytes(d)
return d, pos
def blizdecode(b):
d, l = blizdecomp(b)
return d.decode(), l
def bits(b):
"""Returns the bits in a byte"""
if isinstance(b, str):
b = ord(b)
return tuple([(b >> i) & 1 for i in range(8)])
def bitfield(b, idx):
"""Returns an integer representing the bit field. idx may be a slice."""
f = bits(b)[idx]
if f != 0 and f != 1:
val = 0
for i, x in enumerate(f):
val += x * 2**i
f = val
return f
def b2f(b):
return struct.unpack('<f', b)[0]
RACES = {
0x01: 'human',
0x02: 'orc',
0x04: 'nightelf',
0x08: 'undead',
0x10: 'daemon',
0x20: 'random',
0x40: 'selectable/fixed',
}
SPEEDS = ('slow', 'normal', 'fast', 'unused')
OBSERVER = ('off', 'unused', 'defeat', 'on')
FIXED_TEAMS = ('off', 'unused', 'unused', 'on')
GAME_TYPES = {
0x00: 'unknown',
0x01: '1on1',
0x09: 'custom',
0x1D: 'single player game',
0x20: 'ladder team game',
}
STATUS = {0x00: 'empty', 0x01: 'closed', 0x02: 'used'}
# Use RGB hex values for new colors because they are strange
COLORS = ('red', 'blue', 'cyan', 'purple',
'yellow', 'orange', 'green', 'pink',
'gray', 'light blue', 'dark green', 'brown',
'9B0000', '0000C3', '00EAFF', 'BE00FE',
'EBCD87', 'F8A48B', 'BFFF80', 'DCB9EB',
'282828', 'EBF0FF', '00781E', 'A46F33',
'observer')
AI_STRENGTH = {0x00: 'easy', 0x01: 'normal', 0x02: 'insane'}
SELECT_MODES = {
0x00: 'team & race selectable',
0x01: 'team not selectable',
0x03: 'team & race not selectable',
0x04: 'race fixed to random',
0xcc: 'automated match making',
0xac: 'automated match making',
}
CHAT_MODES = {0x00: 'all', 0x01: 'allies', 0x02: 'observers'}
NUMERIC_ITEM = b'\r\x00'
ITEMS = {
# string encoded item id
b'AEah': 'Thorns Aura',
b'AEar': 'Trueshot',
b'AEbl': 'Blink',
b'AEer': 'Entangling Roots',
b'AEev': 'Evasion',
b'AEfk': 'Fan of Knives',
b'AEfn': 'Force of Nature',
b'AEim': 'Immolation',
b'AEmb': 'Mana Burn',
b'AEme': 'Metamorphosis',
b'AEsf': 'Starfall',
b'AEsh': 'Shadow Strike',
b'AEst': 'Scout',
b'AEsv': 'Vengence',
b'AEtq': 'Tranquility',
b'AHab': 'Brilliance Aura',
b'AHad': 'Devotion Aura',
b'AHav': 'Avatar',
b'AHbh': 'Bash',
b'AHbn': 'Banish',
b'AHbz': 'Blizzard',
b'AHdr': 'Siphon Mana',
b'AHds': 'Divine Shield',
b'AHfa': 'Searing Arrows',
b'AHfs': 'Flame Strike',
b'AHhb': 'Holy Bolt',
b'AHmt': 'Mass Teleport',
b'AHpx': 'Summon Phoenix',
b'AHre': 'Resurrection',
b'AHtb': 'Storm Bolt',
b'AHtc': 'Thunder Clap',
b'AHwe': 'Summon Water Elemental',
b'AOae': 'Endurance Aura',
b'AOcl': 'Chain Lightning',
b'AOcr': 'Critical Strike',
b'AOeq': 'Earthquake',
b'AOfs': 'Far Sight',
b'AOhw': 'Healing Wave',
b'AOhx': 'Hex',
b'AOmi': 'Mirror Image',
b'AOre': 'Reincarnation',
b'AOsf': 'Feral Spirit',
b'AOsh': 'Shockwave',
b'AOsw': 'Serpent Ward',
b'AOvd': 'Big Bad Voodoo',
b'AOwk': 'Wind Walk',
b'AOws': 'War Stomp',
b'AOww': 'Blade Storm',
b'AUan': 'Animate Dead',
b'AUau': 'Unholy Aura',
b'AUav': 'Vampiric Aura',
b'AUcb': 'Carrion Beetles',
b'AUcs': 'Carrion Swarm',
b'AUdc': 'Death Coil',
b'AUdd': 'Death and Decay',
b'AUdp': 'Death Pact',
b'AUdr': 'Dark Ritual',
b'AUfn': 'Frost Nova',
b'AUfu': 'Frost Armor',
b'AUim': 'Impale',
b'AUin': 'Inferno',
b'AUls': 'Locust Swarm',
b'AUsl': 'Sleep',
b'AUts': 'Spiked Carapace',
b'eaoe': 'Ancient of Lore',
b'eaom': 'Ancient of War',
b'eaow': 'Ancient of Wind',
b'earc': 'Archer',
b'eate': 'Altar of Elders',
b'ebal': 'Ballista',
b'Ecen': 'Cenarius',
b'echm': 'Chimeara',
b'edcm': 'Druid of the Claw (Metamophed)',
b'Edem': 'Demon Hunter',
b'eden': 'Ancient of Wonders',
b'Edmm': 'Demon Hunter (Metamophed)',
b'edob': 'Hunter\'s Hall',
b'edoc': 'Druid of the Claw',
b'edol': 'Bear Den',
b'edos': 'Chimaera Roost',
b'edot': 'Druid of the Talon',
b'edry': 'Dryad',
b'edtm': 'Druid of the Talon (Metamophed)',
b'Eevi': 'Illidan',
b'Eevm': 'Illidan Demon',
b'efdr': 'Faerie Dragon',
b'efon': 'Ent',
b'egol': 'Entangled Gold Mine',
b'ehip': 'Hippogryph',
b'ehpr': 'Hippogryph Rider',
b'Ekee': 'Keeper of the Grove',
b'Emoo': 'Priestess of the Moon',
b'emow': 'Moon Well',
b'emtg': 'Mountain Giant',
b'esen': 'Huntress',
b'eshd': 'Shandris',
b'etoa': 'Tree of Ages',
b'etoe': 'Tree of Eternity',
b'etol': 'Tree of Life',
b'etrp': 'Ancient Protector',
b'Ewar': 'Warden',
b'Ewrd': 'Maiev',
b'ewsp': 'Wisp',
b'halt': 'Altar of Kings',
b'Hamg': 'Archmage',
b'harm': 'Workshop',
b'hars': 'Arcane Sanctum',
b'hatw': 'Arcane Tower',
b'hbar': 'Barracks',
b'hbep': 'Blood Elf Priest',
b'hbes': 'Blood Elf Sorceress',
b'hbla': 'Blacksmith',
b'Hblm': 'Blood Mage',
b'hcas': 'Castle',
b'hcth': 'High Elf Footman',
b'hctw': 'Cannon Tower',
b'hdhw': 'Dragonhawk Rider',
b'hfoo': 'Footman',
b'hgra': 'Aviary',
b'hgry': 'Gryphon Rider',
b'hgtw': 'Guard Tower',
b'hgyr': 'Flying Machine',
b'hhes': 'High Elf Swordman',
b'hhou': 'House',
b'Hjai': 'Jaina',
b'Hkal': 'Kael\'thas',
b'hkee': 'Keep',
b'hkni': 'Knight',
b'Hlgr': 'Garithos',
b'hlum': 'Lumber Mill',
b'Hmbr': 'Muradin',
b'hmil': 'Militia',
b'Hmkg': 'Mountain King',
b'hmpr': 'Priest',
b'hmtm': 'Mortar',
b'hmtt': 'Siege Engine',
b'Hpal': 'Paladin',
b'hpea': 'Peasant',
b'hrif': 'Rifleman',
b'hrtt': 'Siege Engine (Rocket)',
b'hsor': 'Sorceress',
b'hspt': 'Spell Breaker',
b'htow': 'Town Hall',
b'htws': 'Church',
b'hvlt': 'Arcane Vault',
b'Hvsh': 'Lady Vashj',
b'Hvwd': 'Sylvanus',
b'hwat': 'Elemental',
b'hwtw': 'Watch Tower',
b'nbal': 'Doomgaurd',
b'Nbbc': 'Chaos Blademaster',
b'ncap': 'Corrupt Protector',
b'ncaw': 'Corrup Ancient of War',
b'nchg': 'Chaos Grunt',
b'nchr': 'Chaos Raider',
b'nchw': 'Chaos Warlock',
b'nckb': 'Chaos Kodo Beast',
b'ncmw': 'Corrupt Moon Well',
b'ncpn': 'Chaos Peon',
b'nctl': 'Corrupt Tree of Life',
b'ndmg': 'Demon Gate',
b'nefm': 'High Elf Farm',
b'negf': 'High Elf Earth',
b'negm': 'High Elf Sky',
b'negt': 'High Elf Guard Tower',
b'negt': 'High Elf Tower',
b'nenc': 'Corrupt Treant',
b'nenp': 'Poison Treant',
b'nepl': 'Plauge Treant',
b'nfel': 'Felhound',
b'nfrb': 'Furbolg Tracker',
b'nfre': 'Furbolg Elder',
b'nfrg': 'Furbolg Champion',
b'nfrl': 'Furbolg',
b'nfrs': 'Furbolg Shaman',
b'ngsp': 'Sapper',
b'nhea': 'High Elf Archer',
b'nheb': 'High Elf Barracks',
b'nhew': 'Blood Elf Peasant',
b'nhyc': 'Dragon Turtle',
b'ninf': 'Infernal',
b'nmpe': 'Mur\'gul Slave',
b'nmyr': 'Myrmidon',
b'nnad': 'Altar of the Depths',
b'nnfm': 'Coral Bed',
b'Nngs': 'Naga Sorceress',
b'nnmg': 'Mur\'gul Reaver',
b'nnrg': 'Naga Royal Guard',
b'nnsa': 'Shrine of Azshara',
b'nnsg': 'Naga Spawning Grounds',
b'nnsw': 'Naga Siren',
b'nntg': 'Tidal Guardian',
b'nntt': 'Temple of Tides',
b'nomg': 'Ogre Magi',
b'npgf': 'Pig Farm',
b'Npld': 'Pit Lord',
b'nrwm': 'Orc Dragonrider',
b'nsat': 'Trickster',
b'nsfp': 'Forest Troll Shadow Priest',
b'nska': 'Skeleton Archer',
b'nskf': 'Burning Archer',
b'nskg': 'Giant Skeleton Warrior',
b'nskm': 'Skeletal Marksman',
b'nsnp': 'Snap Dragon',
b'nsth': 'Hellcaller',
b'nstl': 'Soulstealer',
b'nsts': 'Shadowdancer',
b'nsty': 'Satyr',
b'nw2w': 'Warcraft II Warlock',
b'nwgs': 'Couatl',
b'nws1': 'Dragon Hawk',
b'nzep': 'Zepplin',
b'oalt': 'Altar of Storms',
b'oang': 'Guardian',
b'obar': 'Orc Barracks',
b'obea': 'Beastiary',
b'Obla': 'Blademaster',
b'ocat': 'Catapult',
b'ocbw': 'Chaos Burrow',
b'odoc': 'Troll Witch Doctor',
b'Ofar': 'Far Seer',
b'ofor': 'Forge',
b'ofrt': 'Fortress',
b'ogre': 'Great Hall',
b'Ogrh': 'Grom Hellscream',
b'ogru': 'Grunt',
b'ohun': 'Troll Headhunter',
b'okod': 'Kodo Beast',
b'opeo': 'Peon',
b'Opgh': 'Chaos Grom Hellscream',
b'orai': 'Raider',
b'Oshd': 'Shadow Hunter',
b'oshm': 'Shaman',
b'osld': 'Spirit Lodge',
b'ospm': 'Spirit Walker (Metamophed)',
b'ospw': 'Spirit Walker',
b'ostr': 'Stronghold',
b'otau': 'Tauren',
b'otbk': 'Troll Berserker',
b'otbr': 'Troll Batrider',
b'Otch': 'Tauren Chieftain',
b'Othr': 'Thrall',
b'otrb': 'Burrow',
b'otto': 'Tauren Totem',
b'ovln': 'Voodoo Lounge',
b'owtw': 'Orc Watch Tower',
b'owyv': 'Wyvern',
b'Recb': 'Upgrade Corrosive Breath',
b'Redc': 'Upgrade Druid of the Claw',
b'Redt': 'Upgrade Druid of the Talon',
b'Reeb': 'Upgrade Mark of the Claw',
b'Reec': 'Upgrade Mark of the Talon',
b'Rehs': 'Upgrade Hardened Skin',
b'Reht': 'Upgrade Hippogryph Taming',
b'Reib': 'Upgrade Improved Bows',
b'Rema': 'Upgrade Moon Armor',
b'Remg': 'Upgrade Moon Glaive',
b'Remk': 'Upgrade Marksmanship',
b'Renb': 'Upgrade Nature\'s Blessing',
b'Repd': 'Upgrade Vorpal Blades',
b'Rerh': 'Upgrade Reinforced Hides',
b'Rers': 'Upgrade Resistant Skin',
b'Resc': 'Upgrade Sentinel',
b'Resi': 'Upgrade Abolish Magic',
b'Resm': 'Upgrade Strength of the Moon',
b'Resw': 'Upgrade Strength of the Wild',
b'Reuv': 'Upgrade Ultravision',
b'Rews': 'Upgrade Well Sprint',
b'Rhaa': 'Upgrade ARTILLERY',
b'Rhac': 'Upgrade Masonry',
b'Rhan': 'Upgrade Animal War Training',
b'Rhar': 'Upgrade Plating',
b'Rhcd': 'Upgrade Cloud',
b'Rhde': 'Upgrade Defend',
b'Rhfc': 'Upgrade Flak Cannons',
b'Rhfs': 'Upgrade Fragmentation Shards',
b'Rhgb': 'Upgrade Flying Machine Bombs',
b'Rhhb': 'Upgrade Storm Hammers',
b'Rhla': 'Upgrade Leather Armor',
b'Rhlh': 'Upgrade Lumber Harvesting',
b'Rhme': 'Upgrade Melee Weapons',
b'Rhmi': 'Upgrade GOLD',
b'Rhpt': 'Upgrade Priest Training',
b'Rhra': 'Upgrade Ranged Weapons',
b'Rhri': 'Upgrade Long Rifles',
b'Rhrt': 'Upgrade Barrage',
b'Rhse': 'Upgrade Magic Sentry',
b'Rhsr': 'Upgrade Flare',
b'Rhss': 'Upgrade Control Magic',
b'Rhst': 'Upgrade Sorceress Training',
b'Rnam': 'Upgrade Naga Armor',
b'Rnat': 'Upgrade Naga Attack',
b'Rnen': 'Upgrade Naga Ensnare',
b'Rnsi': 'Upgrade Naga Abolish Magic',
b'Rnsw': 'Upgrade Siren',
b'Roaa': 'Upgrade Orc Artillery',
b'Roar': 'Upgrade Unit Armor',
b'Robf': 'Upgrade Burning Oil',
b'Robk': 'Upgrade Berserker Upgrade',
b'Robs': 'Upgrade Berserker Strength',
b'Roch': 'Upgrade Chaos',
b'Roen': 'Upgrade Ensnare',
b'Rolf': 'Upgrade Liquid Fire',
b'Rome': 'Upgrade Melee Weapons',
b'Ropg': 'Upgrade Pillage',
b'Rora': 'Upgrade Ranged Weapons',
b'Rorb': 'Upgrade Reinforced Defenses',
b'Rosp': 'Upgrade Spiked Barricades',
b'Rost': 'Upgrade Shaman Training',
b'Rotr': 'Upgrade Troll Regeneration',
b'Rovs': 'Upgrade Envenomed Spears',
b'Rowd': 'Upgrade Witch Doctor Training',
b'Rows': 'Upgrade Pulverize',
b'Rowt': 'Upgrade Spirit Walker Training',
b'Ruab': 'Upgrade ABOM',
b'Ruac': 'Upgrade Cannibalize',
b'Ruar': 'Upgrade Unholy Armor',
b'Ruax': 'Upgrade ABOM_EXPL',
b'Ruba': 'Upgrade Banshee Training',
b'Rubu': 'Upgrade Burrow',
b'Rucr': 'Upgrade Creature Carapace',
b'Ruex': 'Upgrade Exhume Corpses',
b'Rufb': 'Upgrade Freezing Breath',
b'Rugf': 'Upgrade Ghoul Frenzy',
b'Rume': 'Upgrade Unholy Strength',
b'Rump': 'Upgrade MEAT_WAGON',
b'Rune': 'Upgrade Necromancer Training',
b'Rupc': 'Upgrade Disease Cloud',
b'Rura': 'Upgrade Creature Attack',
b'Rurs': 'Upgrade SACRIFICE',
b'Rusf': 'Upgrade Stone Form',
b'Rusl': 'Upgrade Skeletal Longevity',
b'Rusm': 'Upgrade Skeletal Mastery',
b'Rusp': 'Upgrade Destroyer Form',
b'Ruwb': 'Upgrade Web',
b'Rwdm': 'Upgrade War Drums Damage Increase',
b'uabo': 'Abomination',
b'uaco': 'Acolyte',
b'uaod': 'Altar of Darkness',
b'uarb': 'Undead Barge',
b'uban': 'Banshee',
b'ubon': 'Boneyard',
b'ubsp': 'Destroyer',
b'Ucrl': 'Crypt Lord',
b'ucry': 'Pit Fiend',
b'Udea': 'Death Knight',
b'Udre': 'Dread Lord',
b'Udth': 'Detheroc',
b'ufro': 'Frost Wyrm',
b'ugar': 'Gargoyle',
b'ugho': 'Ghoul',
b'ugol': 'Haunted Gold Mine',
b'ugrm': 'Gargoyle (Stone)',
b'ugrv': 'Graveyard',
b'ugsp': 'Gargoyle Spire',
b'Ulic': 'Lich',
b'Umal': 'Malganis',
b'umtw': 'Meat Wagon',
b'unec': 'Necromancer',
b'unp1': 'Halls of the Dead',
b'unp2': 'Black Citadel',
b'unpl': 'Necropolis',
b'uobs': 'Obsidian Statue',
b'usap': 'Sacrificial Pit',
b'usep': 'Crypt',
b'ushd': 'Shade',
b'uske': 'Skeleton Warrior',
b'uslh': 'Slaughterhouse',
b'Utic': 'Tichondrius',
b'utod': 'Temple of the Damned',
b'utom': 'Tomb of Relics',
b'uzg1': 'Spirit Tower',
b'uzg2': 'Nerubian Tower',
b'uzig': 'Ziggurat',
# Others
b'nskf': 'Burning Archer',
b'nws1': 'Dragon Hawk',
b'nban': 'Bandit',
b'nrog': 'Rogue',
b'nenf': 'Enforcer',
b'nass': 'Assassin',
b'nbdk': 'Black Drake',
b'nrdk': 'Red Dragon Whelp',
b'nbdr': 'Black Dragon Whelp',
b'nrdr': 'Red Drake',
b'nbwm': 'Black Dragon',
b'nrwm': 'Red Dragon',
b'nadr': 'Blue Dragon',
b'nadw': 'Blue Dragon Whelp',
b'nadk': 'Blue Drake',
b'nbzd': 'Bronze Dragon',
b'nbzk': 'Bronze Drake',
b'nbzw': 'Bronze Dragon Whelp',
b'ngrd': 'Green Dragon',
b'ngdk': 'Green Drake',
b'ngrw': 'Green Dragon Whelp',
b'ncea': 'Centaur Archer',
b'ncen': 'Centaur Outrunner',
b'ncer': 'Centaur Drudge',
b'ndth': 'Dark Troll High Priest',
b'ndtp': 'Dark Troll Shadow Priest',
b'ndtb': 'Dark Troll Berserker',
b'ndtw': 'Dark Troll WarLord',
b'ndtr': 'Dark Troll',
b'ndtt': 'Dark Troll Trapper',
b'nfsh': 'Forest Troll High Priest',
b'nfsp': 'Forest Troll Shadow Priest',
b'nftr': 'Forest Troll',
b'nftb': 'Forest Troll Berserker',
b'nftt': 'Forest Troll Trapper',
b'nftk': 'Forest Troll WarLord',
b'ngrk': 'Mud Golem',
b'ngir': 'Goblin Shredder',
b'nfrs': 'Furbolg Shaman',
b'ngna': 'Gnoll Poacher',
b'ngns': 'Gnoll Assassin',
b'ngno': 'Gnoll',
b'ngnb': 'Gnoll Brute',
b'ngnw': 'Gnoll Warden',
b'ngnv': 'Gnoll Overseer',
b'ngsp': 'Goblin Sapper',
b'nhrr': 'Harpy Rogue',
b'nhrw': 'Harpy Windwitch',
b'nits': 'Ice Troll Berserker',
b'nitt': 'Ice Troll Trapper',
b'nkob': 'Kobold',
b'nkog': 'Kobold Geomancer',
b'nthl': 'Thunder Lizard',
b'nmfs': 'Murloc Flesheater',
b'nmrr': 'Murloc Huntsman',
b'nowb': 'Wildkin',
b'nrzm': 'Razormane Medicine Man',
b'nnwa': 'Nerubian Warrior',
b'nnwl': 'Nerubian Webspinner',
b'nogr': 'Ogre Warrior',
b'nogm': 'Ogre Mauler',
b'nogl': 'Ogre Lord',
b'nomg': 'Ogre Magi',
b'nrvs': 'Frost Revenant',
b'nslf': 'Sludge Flinger',
b'nsts': 'Satyr Shadowdancer',
b'nstl': 'Satyr Soulstealer',
b'nzep': 'Goblin Zeppelin',
b'ntrt': 'Giant Sea Turtle',
b'nlds': 'Makrura Deepseer',
b'nlsn': 'Makrura Snapper',
b'nmsn': 'Mur\'gul Snarecaster',
b'nscb': 'Spider Crab Shorecrawler',
b'nbot': 'Transport Ship',
b'nsc2': 'Spider Crab Limbripper',
b'nsc3': 'Spider Crab Behemoth',
b'nbdm': 'Blue Dragonspawn Meddler',
b'nmgw': 'Magnataur Warrior',
b'nanb': 'Barbed Arachnathid',
b'nanm': 'Barbed Arachnathid',
b'nfps': 'Polar Furbolg Shaman',
b'nmgv': 'Magic Vault',
b'nitb': 'Icy Treasure Box',
b'npfl': 'Fel Beast',
b'ndrd': 'Draenei Darkslayer',
b'ndrm': 'Draenei Disciple',
b'nvdw': 'Voidwalker',
b'nvdg': 'Greater Voidwalker',
b'nnht': 'Nether Dragon Hatchling',
b'nndk': 'Nether Drake',
b'nndr': 'Nether Dragon',
# real items
b'LTlt': 'Tree',
b'nmer': 'Merchant',
b'ntav': 'Tavern',
b'ngol': 'Goldmine',
b'amrc': 'Amulet of Recall',
b'ankh': 'Ankh of Reincarnation',
b'belv': 'Boots of Quel\'Thalas +6',
b'bgst': 'Belt of Giant Strength +6',
b'bspd': 'Boots of Speed',
b'ccmd': 'Scepter of Mastery',
b'ciri': 'Robe of the Magi +6',
b'ckng': 'Crown of Kings +5',
b'clsd': 'Cloak of Shadows',
b'crys': 'Crystal Ball',
b'desc': 'Kelen\'s Dagger of Escape',
b'gemt': 'Gem of True Seeing',
b'gobm': 'Goblin Land Mines',
b'gsou': 'Soul Gem',
b'guvi': 'Glyph of Ultravision',
b'gfor': 'Glyph of Fortification',
b'soul': 'Soul',
b'mdpb': 'Medusa Pebble',
b'rag1': 'Slippers of Agility +3',
b'rat3': 'Claws of Attack +3',
b'rin1': 'Mantle of Intelligence +3',
b'rde1': 'Ring of Protection +2',
b'rde2': 'Ring of Protection +3',
b'rde3': 'Ring of Protection +4',
b'rhth': 'Khadgar\'s Gem of Health',
b'rst1': 'Gauntlets of Ogre Strength +3',
b'ofir': 'Orb of Fire',
b'ofro': 'Orb of Frost',
b'olig': 'Orb of Lightning',
b'oli2': 'Orb of Lightning',
b'oven': 'Orb of Venom',
b'odef': 'Orb of Darkness',
b'ocor': 'Orb of Corruption',
b'pdiv': 'Potion of Divinity',
b'phea': 'Potion of Healing',
b'pghe': 'Potion of Greater Healing',
b'pinv': 'Potion of Invisibility',
b'pgin': 'Potion of Greater Invisibility',
b'pman': 'Potion of Mana',
b'pgma': 'Potion of Greater Mana',
b'pnvu': 'Potion of Invulnerability',
b'pnvl': 'Potion of Lesser Invulnerability',
b'pres': 'Potion of Restoration',
b'pspd': 'Potion of Speed',
b'rlif': 'Ring of Regeneration',
b'rwiz': 'Sobi Mask',
b'sfog': 'Horn of the Clouds',
b'shea': 'Scroll of Healing',
b'sman': 'Scroll of Mana',
b'spro': 'Scroll of Protection',
b'sres': 'Scroll of Restoration',
b'ssil': 'Staff of Silence',
b'stwp': 'Scroll of Town Portal',
b'tels': 'Goblin Night Scope',
b'tdex': 'Tome of Agility',
b'texp': 'Tome of Experience',
b'tint': 'Tome of Intelligence',
b'tkno': 'Tome of Power',
b'tstr': 'Tome of Strength',
b'ward': 'Warsong Battle Drums',
b'will': 'Wand of Illusion',
b'wneg': 'Wand of Negation',
b'rdis': 'Rune of Dispel Magic',
b'rwat': 'Rune of the Watcher',
b'fgrd': 'Red Drake Egg',
b'fgrg': 'Stone Token',
b'fgdg': 'Demonic Figurine',
b'fgfh': 'Spiked Collar',
b'fgsk': 'Book of the Dead',
b'engs': 'Enchanted Gemstone',
b'k3m1': 'Mooncrystal',
b'modt': 'Mask of Death',
b'sand': 'Scroll of Animate Dead',
b'srrc': 'Scroll of Resurrection',
b'sror': 'Scroll of the Beast',
b'infs': 'Inferno Stone',
b'shar': 'Ice Shard',
b'wild': 'Amulet of the Wild',
b'wswd': 'Sentry Wards',
b'whwd': 'Healing Wards',
b'wlsd': 'Wand of Lightning Shield',
b'wcyc': 'Wand of the Wind',
b'rnec': 'Rod of Necromancy',
b'pams': 'Anti-magic Potion',
b'clfm': 'Cloak of Flames',
b'evtl': 'Talisman of Evasion',
b'nspi': 'Necklace of Spell Immunity',
b'lhst': 'The Lion Horn of Stormwind',
b'kpin': 'Khadgar\'s Pipe of Insight',
b'sbch': 'Scourge Bone Chimes',
b'afac': 'Alleria\'s Flute of Accuracy',
b'ajen': 'Ancient Janggo of Endurance',
b'lgdh': 'Legion Doom-Horn',
b'hcun': 'Hood of Cunning',
b'mcou': 'Medallion of Courage',
b'hval': 'Helm of Valor',
b'cnob': 'Circlet of Nobility',
b'prvt': 'Periapt of Vitality',
b'tgxp': 'Tome of Greater Experience',
b'mnst': 'Mana Stone',
b'hlst': 'Health Stone',
b'tpow': 'Tome of Knowledge',
b'tst2': 'Tome of Strength +2',
b'tin2': 'Tome of Intelligence +2',
b'tdx2': 'Tome of Agility +2',
b'rde0': 'Ring of Protection +1',
b'rde4': 'Ring of Protection +5',
b'rat6': 'Claws of Attack +6',
b'rat9': 'Claws of Attack +9',
b'ratc': 'Claws of Attack +12',
b'ratf': 'Claws of Attack +15',
b'manh': 'Manual of Health',
b'pmna': 'Pendant of Mana',
b'penr': 'Pendant of Energy',
b'gcel': 'Gloves of Haste',
b'totw': 'Talisman of the Wild',
b'phlt': 'Phat Lewt',
b'gopr': 'Glyph of Purification',
b'ches': 'Cheese',
b'mlst': 'Maul of Strength',
b'rnsp': 'Ring of Superiority',
b'brag': 'Bracer of Agility',
b'sksh': 'Skull Shield',
b'vddl': 'Voodoo Doll',
b'sprn': 'Spider Ring',
b'tmmt': 'Totem of Might',
b'anfg': 'Ancient Figurine',
b'lnrn': 'Lion\'s Ring',
b'iwbr': 'Ironwood Branch',
b'jdrn': 'Jade Ring',
b'drph': 'Druid Pouch',
b'hslv': 'Healing Salve',
b'pclr': 'Clarity Potion',
b'plcl': 'Lesser Clarity Potion',
b'rej1': 'Minor Replenishment Potion',
b'rej2': 'Lesser Replenishment Potion',
b'rej3': 'Replenishment Potion',
b'rej4': 'Greater Replenishment Potion',
b'rej5': 'Lesser Scroll of Replenishment',
b'rej6': 'Greater Scroll of Replenishment',
b'sreg': 'Scroll of Regeneration',
b'gold': 'Gold Coins',
b'lmbr': 'Bundle of Lumber',
b'fgun': 'Flare Gun',
b'pomn': 'Potion of Omniscience',
b'gomn': 'Glyph of Omniscience',
b'wneu': 'Wand of Neutralization',
b'silk': 'Spider Silk Broach',
b'lure': 'Monster Lure',
b'skul': 'Sacrificial Skull',
b'moon': 'Moonstone',
b'brac': 'Runed Bracers',
b'vamp': 'Vampiric Potion',
b'woms': 'Wand of Mana Stealing',
b'tcas': 'Tiny Castle',
b'tgrh': 'Tiny Great Hall',
b'tsct': 'Ivory Tower',
b'wshs': 'Wand of Shadowsight',
b'tret': 'Tome of Retraining',
b'sneg': 'Staff of Negation',
b'stel': 'Staff of Teleportation',
b'spre': 'Staff of Preservation',
b'mcri': 'Mechanical Critter',
b'spsh': 'Amulet of Spell Shield',
b'sbok': 'Spell Book',
b'ssan': 'Staff of Sanctuary',
b'shas': 'Scroll of Speed',
b'dust': 'Dust of Appearance',
b'oslo': 'Orb of Slow',
b'dsum': 'Diamond of Summoning',
b'sor1': 'Shadow Orb +1',
b'sor2': 'Shadow Orb +2',
b'sor3': 'Shadow Orb +3',
b'sor4': 'Shadow Orb +4',
b'sor5': 'Shadow Orb +5',
b'sor6': 'Shadow Orb +6',
b'sor7': 'Shadow Orb +7',
b'sor8': 'Shadow Orb +8',
b'sor9': 'Shadow Orb +9',
b'sora': 'Shadow Orb +10',
b'sorf': 'Shadow Orb Fragment',
b'fwss': 'Frost Wyrm Skull Shield',
b'ram1': 'Ring of the Archmagi',
b'ram2': 'Ring of the Archmagi',
b'ram3': 'Ring of the Archmagi',
b'ram4': 'Ring of the Archmagi',
b'shtm': 'Shamanic Totem',
b'shwd': 'Shimmerweed',
b'btst': 'Battle Standard',
b'skrt': 'Skeletal Artifact',
b'thle': 'Thunder Lizard Egg',
b'sclp': 'Secret Level Powerup',
b'gldo': 'Orb of Kil\'jaeden',
b'tbsm': 'Tiny Blacksmith',
b'tfar': 'Tiny Farm',
b'tlum': 'Tiny Lumber Mill',
b'tbar': 'Tiny Barracks',
b'tbak': 'Tiny Altar of Kings',
b'mgtk': 'Magic Key Chain',
b'stre': 'Staff of Reanimation',
b'horl': 'Sacred Relic',
b'hbth': 'Helm of Battlethirst',
b'blba': 'Bladebane Armor',
b'rugt': 'Runed Gauntlets',
b'frhg': 'Firehand Gauntlets',
b'gvsm': 'Gloves of Spell Mastery',
b'crdt': 'Crown of the DeathLord',
b'arsc': 'Arcane Scroll',
b'scul': 'Scroll of the Unholy Legion',
b'tmsc': 'Tome of Sacrifices',
b'dtsb': 'Drek\'thar\'s Spellbook',
b'grsl': 'Grimoire of Souls',
b'arsh': 'Arcanite Shield',
b'shdt': 'Shield of the DeathLord',
b'shhn': 'Shield of Honor',
b'shen': 'Enchanted Shield',
b'thdm': 'Thunderlizard Diamond',
b'stpg': 'Clockwork Penguin',
b'shrs': 'Shimmerglaze Roast',
b'bfhr': 'Bloodfeather\'s Heart',
b'cosl': 'Celestial Orb of Souls',
b'shcw': 'Shaman Claws',
b'srbd': 'Searing Blade',
b'frgd': 'Frostguard',
b'envl': 'Enchanted Vial',
b'rump': 'Rusty Mining Pick',
b'mort': 'Mogrin\'s Report',
b'srtl': 'Serathil',
b'stwa': 'Sturdy War Axe',
b'klmm': 'Killmaim',
b'rots': 'Scepter of the Sea',
b'axas': 'Ancestral Staff',
b'mnsf': 'Mindstaff',
b'schl': 'Scepter of Healing',
b'asbl': 'Assassin\'s Blade',
b'kgal': 'Keg of Ale',
b'dphe': 'Thunder Phoenix Egg',
b'dkfw': 'Keg of Thunderwater',
b'dthb': 'Thunderbloom Bulb',
# extra heros
b'Npbm': 'Pandaren Brewmaster',
b'Nbrn': 'Dark Ranger',
b'Nngs': 'Naga Sea Witch',
b'Nplh': 'Pit Lord',
b'Nbst': 'Beastmaster',
b'Ntin': 'Goblin Tinker',
b'Nfir': 'FireLord',
b'Nalc': 'Goblin Alchemist',
# extra hero abilities
b'AHbz': 'Archmage:Blizzard',
b'AHwe': 'Archmage:Summon Water Elemental',
b'AHab': 'Archmage:Brilliance Aura',
b'AHmt': 'Archmage:Mass Teleport',
b'AHtb': 'Mountain King:Storm Bolt',
b'AHtc': 'Mountain King:Thunder Clap',
b'AHbh': 'Mountain King:Bash',
b'AHav': 'Mountain King:Avatar',
b'AHhb': 'Paladin:Holy Light',
b'AHds': 'Paladin:Divine Shield',
b'AHad': 'Paladin:Devotion Aura',
b'AHre': 'Paladin:Resurrection',
b'AHdr': 'Blood Mage:Siphon Mana',
b'AHfs': 'Blood Mage:Flame Strike',
b'AHbn': 'Blood Mage:Banish',
b'AHpx': 'Blood Mage:Summon Phoenix',
b'AEmb': 'Demon Hunter:Mana Burn',
b'AEim': 'Demon Hunter:Immolation',
b'AEev': 'Demon Hunter:Evasion',
b'AEme': 'Demon Hunter:Metamorphosis',
b'AEer': 'Keeper of the Grove:Entangling Roots',
b'AEfn': 'Keeper of the Grove:Force of Nature',
b'AEah': 'Keeper of the Grove:Thorns Aura',
b'AEtq': 'Keeper of the Grove:Tranquility',
b'AEst': 'Priestess of the Moon:Scout',
b'AHfa': 'Priestess of the Moon:Searing Arrows',
b'AEar': 'Priestess of the Moon:Trueshot Aura',
b'AEsf': 'Priestess of the Moon:Starfall',
b'AEbl': 'Warden:Blink',
b'AEfk': 'Warden:Fan of Knives',
b'AEsh': 'Warden:Shadow Strike',
b'AEsv': 'Warden:Spirit of Vengeance',
b'AOwk': 'Blademaster:Wind Walk',
b'AOmi': 'Blademaster:Mirror Image',
b'AOcr': 'Blademaster:Critical Strike',
b'AOww': 'Blademaster:Bladestorm',
b'AOcl': 'Far Seer:Chain Lighting',
b'AOfs': 'Far Seer:Far Sight',
b'AOsf': 'Far Seer:Feral Spirit',
b'AOeq': 'Far Seer:Earth Quake',
b'AOsh': 'Tauren Chieftain:Shockwave',
b'AOae': 'Tauren Chieftain:Endurance Aura',
b'AOws': 'Tauren Chieftain:War Stomp',
b'AOre': 'Tauren Chieftain:Reincarnation',
b'AOhw': 'Shadow Hunter:Healing Wave',
b'AOhx': 'Shadow Hunter:Hex',
b'AOsw': 'Shadow Hunter:Serpent Ward',
b'AOvd': 'Shadow Hunter:Big Bad Voodoo',
b'AUdc': 'Death Knight:Death Coil',
b'AUdp': 'Death Knight:Death Pact',
b'AUau': 'Death Knight:Unholy Aura',
b'AUan': 'Death Knight:Animate Dead',
b'AUcs': 'Dreadlord:Carrion Swarm',
b'AUsl': 'Dreadlord:Sleep',
b'AUav': 'Dreadlord:Vampiric Aura',
b'AUin': 'Dreadlord:Inferno',
b'AUfn': 'Lich:Frost Nova',
b'AUfa': 'Lich:Frost Armor',
b'AUfu': 'Lich:Frost Armor',
b'AUdr': 'Lich:Dark Ritual',
b'AUdd': 'Lich:Death and Decay',
b'AUim': 'Crypt Lord:Impale',
b'AUts': 'Crypt Lord:Spiked Carapace',
b'AUcb': 'Crypt Lord:Carrion Beetles',
b'AUls': 'Crypt Lord:Locust Swarm',
b'ANbf': 'Pandaren Brewmaster:Breath of Fire',
b'ANdb': 'Pandaren Brewmaster:Drunken Brawler',
b'ANdh': 'Pandaren Brewmaster:Drunken Haze',
b'ANef': 'Pandaren Brewmaster:Storm Earth and Fire',
b'ANdr': 'Dark Ranger:Life Drain',
b'ANsi': 'Dark Ranger:Silence',
b'ANba': 'Dark Ranger:Black Arrow',
b'ANch': 'Dark Ranger:Charm',
b'ANms': 'Naga Sea Witch:Mana Shield',
b'ANfa': 'Naga Sea Witch:Frost Arrows',
b'ANfl': 'Naga Sea Witch:Forked Lightning',
b'ANto': 'Naga Sea Witch:Tornado',
b'ANrf': 'Pit Lord:Rain of Fire',
b'ANca': 'Pit Lord:Cleaving Attack',
b'ANht': 'Pit Lord:Howl of Terror',
b'ANdo': 'Pit Lord:Doom',
b'ANsg': 'Beastmaster:Summon Bear',
b'ANsq': 'Beastmaster:Summon Quilbeast',
b'ANsw': 'Beastmaster:Summon Hawk',
b'ANst': 'Beastmaster:Stampede',
b'ANeg': 'Goblin Tinker:Engineering Upgrade',
b'ANcs': 'Goblin Tinker:Cluster Rockets',
b'ANc1': 'Goblin Tinker:Cluster Rockets 1',
b'ANc2': 'Goblin Tinker:Cluster Rockets 2',
b'ANc3': 'Goblin Tinker:Cluster Rockets 3',
b'ANsy': 'Goblin Tinker:Pocket Factory',
b'ANs1': 'Goblin Tinker:Pocket Factory 1',
b'ANs2': 'Goblin Tinker:Pocket Factory 2',
b'ANs3': 'Goblin Tinker:Pocket Factory 3',
b'ANrg': 'Goblin Tinker:Robo-Goblin',
b'ANg1': 'Goblin Tinker:Robo-Goblin 1',
b'ANg2': 'Goblin Tinker:Robo-Goblin 2',
b'ANg3': 'Goblin Tinker:Robo-Goblin 3',
b'ANic': 'Firelord:Incinerate',
b'ANia': 'Firelord:Incinerate',
b'ANso': 'Firelord:Soul Burn',
b'ANlm': 'Firelord:Summon Lava Spawn',
b'ANvc': 'Firelord:Volcano',
b'ANhs': 'Goblin Alchemist:Healing Spray',
b'ANab': 'Goblin Alchemist:Acid Bomb',
b'ANcr': 'Goblin Alchemist:Chemical Rage',
b'ANtm': 'Goblin Alchemist:Transmute',
# numeric item id
b'\x03\x00\x0D\x00': 'Rightclick',
b'\x04\x00\x0D\x00': 'Stop',
b'\x08\x00\x0D\x00': 'Cancel',
b'\x0C\x00\x0D\x00': 'Set rally point',
b'\x0F\x00\x0D\x00': 'Attack',
b'\x10\x00\x0D\x00': 'Attack ground',
b'\x12\x00\x0D\x00': 'Move unit',
b'\x16\x00\x0D\x00': 'Patrol',
b'\x19\x00\x0D\x00': 'Hold position',
b'\x21\x00\x0D\x00': 'Give item',
b'\x22\x00\x0D\x00': 'Swap item place 7 (slot of item to swap with!)',
b'\x23\x00\x0D\x00': 'Swap item place 8',
b'\x24\x00\x0D\x00': 'Swap item place 4',
b'\x25\x00\x0D\x00': 'Swap item place 5',