Skip to content

Commit

Permalink
Fix ids for SC2 version 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnySc2 committed Jul 28, 2020
1 parent ea56fa6 commit 43ce023
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 35 deletions.
5 changes: 3 additions & 2 deletions sc2/generate_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __init__(self, game_data: GameData = None, game_version: str = None, verbose
def make_key(self, key):
if key[0].isdigit():
key = "_" + key
return key.upper().replace(" ", "_")
# In patch 5.0, the key has "@" character in it which is not possible with python enums
return key.upper().replace(" ", "_").replace("@", "")

def parse_data(self, data):
# for d in data: # Units, Abilities, Upgrades, Buffs, Effects
Expand All @@ -75,7 +76,7 @@ def parse_data(self, data):
else:
exit(f"Not mapped: {v !r}")

key = key.upper().replace(" ", "_")
key = key.upper().replace(" ", "_").replace("@", "")

if "name" in v:
key = f'{v["name"].upper().replace(" ", "_")}_{key}'
Expand Down
24 changes: 20 additions & 4 deletions sc2/ids/ability_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,10 +1264,26 @@ class AbilityId(enum.Enum):
MOVE = 3794
PATROL = 3795
UNLOADUNIT = 3796
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN_CANCEL = 3798
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN_CANCEL = 3800
BATTERYOVERCHARGE_BATTERYOVERCHARGE = 3801
AMORPHOUSARMORCLOUD_AMORPHOUSARMORCLOUD = 3803
LOADOUTSPRAY_LOADOUTSPRAY1 = 3797
LOADOUTSPRAY_LOADOUTSPRAY2 = 3798
LOADOUTSPRAY_LOADOUTSPRAY3 = 3799
LOADOUTSPRAY_LOADOUTSPRAY4 = 3800
LOADOUTSPRAY_LOADOUTSPRAY5 = 3801
LOADOUTSPRAY_LOADOUTSPRAY6 = 3802
LOADOUTSPRAY_LOADOUTSPRAY7 = 3803
LOADOUTSPRAY_LOADOUTSPRAY8 = 3804
LOADOUTSPRAY_LOADOUTSPRAY9 = 3805
LOADOUTSPRAY_LOADOUTSPRAY10 = 3806
LOADOUTSPRAY_LOADOUTSPRAY11 = 3807
LOADOUTSPRAY_LOADOUTSPRAY12 = 3808
LOADOUTSPRAY_LOADOUTSPRAY13 = 3809
LOADOUTSPRAY_LOADOUTSPRAY14 = 3810
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN_CANCEL = 3967
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN_CANCEL = 3970
BATTERYOVERCHARGE_BATTERYOVERCHARGE = 4107
AMORPHOUSARMORCLOUD_AMORPHOUSARMORCLOUD = 4109
SHIELDBATTERYRECHARGEEX5_SHIELDBATTERYRECHARGE = 4111
SHIELDBATTERYRECHARGEEX5_STOP = 4112

def __repr__(self):
return f"AbilityId.{self.name}"
Expand Down
11 changes: 6 additions & 5 deletions sc2/ids/buff_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,12 @@ class BuffId(enum.Enum):
ACCELERATIONZONETEMPORALFIELD = 289
ACCELERATIONZONEFLYINGTEMPORALFIELD = 290
INHIBITORZONEFLYINGTEMPORALFIELD = 291
INHIBITORZONETEMPORALFIELD = 292
RESONATINGGLAIVESPHASESHIFT = 293
AMORPHOUSARMORCLOUD = 294
RAVENSHREDDERMISSILEARMORREDUCTIONUISUBTRUCT = 295
BATTERYOVERCHARGE = 296
LOADOUTSPRAYTRACKER = 292
INHIBITORZONETEMPORALFIELD = 293
RESONATINGGLAIVESPHASESHIFT = 294
AMORPHOUSARMORCLOUD = 295
RAVENSHREDDERMISSILEARMORREDUCTIONUISUBTRUCT = 296
BATTERYOVERCHARGE = 297

def __repr__(self):
return f"BuffId.{self.name}"
Expand Down
62 changes: 38 additions & 24 deletions sc2/ids/unit_typeid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1972,30 +1972,44 @@ class UnitTypeId(enum.Enum):
BUNKERDEPOTMENGSKACGLUESCREENDUMMY = 1964
MISSILETURRETMENGSKACGLUESCREENDUMMY = 1965
ARTILLERYMENGSKACGLUESCREENDUMMY = 1966
PREVIEWBUNKERUPGRADED = 1967
INHIBITORZONESMALL = 1968
INHIBITORZONEMEDIUM = 1969
INHIBITORZONELARGE = 1970
ACCELERATIONZONESMALL = 1971
ACCELERATIONZONEMEDIUM = 1972
ACCELERATIONZONELARGE = 1973
ACCELERATIONZONEFLYINGSMALL = 1974
ACCELERATIONZONEFLYINGMEDIUM = 1975
ACCELERATIONZONEFLYINGLARGE = 1976
INHIBITORZONEFLYINGSMALL = 1977
INHIBITORZONEFLYINGMEDIUM = 1978
INHIBITORZONEFLYINGLARGE = 1979
ASSIMILATORRICH = 1980
EXTRACTORRICH = 1981
MINERALFIELD450 = 1982
MINERALFIELDOPAQUE = 1983
MINERALFIELDOPAQUE900 = 1984
COLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN = 1985
COLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN = 1986
COLLAPSIBLEROCKTOWERPUSHUNITRAMPLEFTGREEN = 1987
COLLAPSIBLEROCKTOWERPUSHUNITRAMPRIGHTGREEN = 1988
COLLAPSIBLEROCKTOWERRAMPLEFTGREEN = 1989
COLLAPSIBLEROCKTOWERRAMPRIGHTGREEN = 1990
LOADOUTSPRAY1 = 1967
LOADOUTSPRAY2 = 1968
LOADOUTSPRAY3 = 1969
LOADOUTSPRAY4 = 1970
LOADOUTSPRAY5 = 1971
LOADOUTSPRAY6 = 1972
LOADOUTSPRAY7 = 1973
LOADOUTSPRAY8 = 1974
LOADOUTSPRAY9 = 1975
LOADOUTSPRAY10 = 1976
LOADOUTSPRAY11 = 1977
LOADOUTSPRAY12 = 1978
LOADOUTSPRAY13 = 1979
LOADOUTSPRAY14 = 1980
PREVIEWBUNKERUPGRADED = 1981
INHIBITORZONESMALL = 1982
INHIBITORZONEMEDIUM = 1983
INHIBITORZONELARGE = 1984
ACCELERATIONZONESMALL = 1985
ACCELERATIONZONEMEDIUM = 1986
ACCELERATIONZONELARGE = 1987
ACCELERATIONZONEFLYINGSMALL = 1988
ACCELERATIONZONEFLYINGMEDIUM = 1989
ACCELERATIONZONEFLYINGLARGE = 1990
INHIBITORZONEFLYINGSMALL = 1991
INHIBITORZONEFLYINGMEDIUM = 1992
INHIBITORZONEFLYINGLARGE = 1993
ASSIMILATORRICH = 1994
EXTRACTORRICH = 1995
MINERALFIELD450 = 1996
MINERALFIELDOPAQUE = 1997
MINERALFIELDOPAQUE900 = 1998
COLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN = 1999
COLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN = 2000
COLLAPSIBLEROCKTOWERPUSHUNITRAMPLEFTGREEN = 2001
COLLAPSIBLEROCKTOWERPUSHUNITRAMPRIGHTGREEN = 2002
COLLAPSIBLEROCKTOWERRAMPLEFTGREEN = 2003
COLLAPSIBLEROCKTOWERRAMPRIGHTGREEN = 2004

def __repr__(self):
return f"UnitTypeId.{self.name}"
Expand Down

0 comments on commit 43ce023

Please sign in to comment.