Skip to content

Commit

Permalink
feat: new 5.0.13 ids and id fixes (#75)
Browse files Browse the repository at this point in the history
* -5.0.13 new ids

* -5.0.13 new ids

---------

Co-authored-by: ketroc <[email protected]>
  • Loading branch information
Ketroc and ketroc authored Jul 22, 2024
1 parent dd65981 commit 9b47d31
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ private boolean connect(
this.baseBuild = ping.getBaseBuild();
Units.remapForBuild(this.baseBuild);
Abilities.remapForBuild(this.baseBuild);
Upgrades.remapForBuild(this.baseBuild);
}, () -> {
throw new IllegalStateException("ping failed");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public enum Abilities implements Ability {
EFFECT_MASS_RECALL(3686, UNIT),
EFFECT_MASS_RECALL_MOTHERSHIP(2368, UNIT),
EFFECT_MASS_RECALL_MOTHERSHIP_CORE(1974, UNIT),
EFFECT_MOTHERSHIP_CLOAK(4122, UNIT),
EFFECT_MOTHERSHIP_CLOAK(4122, NONE),
EFFECT_MOTHERSHIP_CLOAK_CANCEL(4123, NONE),
EFFECT_MEDIVAC_IGNITE_AFTERBURNERS(2116, NONE),
EFFECT_NEURAL_PARASITE(249, UNIT),
EFFECT_NUKE_CALL_DOWN(1622, POINT),
Expand Down Expand Up @@ -281,6 +282,8 @@ public enum Abilities implements Ability {
LOAD_MEDIVAC(394, UNIT),
MORPH_ARCHON(1766, NONE),
MORPH_BROODLORD(1372, NONE),
MORPH_BANELING(4119, NONE),
MORPH_BANELING_CANCEL(4120, NONE),
MORPH_GATEWAY(1520, NONE),
MORPH_GREATER_SPIRE(1220, NONE),
MORPH_HELLBAT(1998, NONE),
Expand Down Expand Up @@ -571,7 +574,11 @@ public enum Abilities implements Ability {
VIPER_PARASITIC_BOMB_RELAY_PARASITIC_BOMB(3789, NONE),
PARASITIC_BOMB_RELAY_DODGE_PARASITIC_BOMB(3791, NONE),
BATTERY_OVERCHARGE(4107, UNIT),
AMORPHOUS_ARMOR_CLOUD(4109, POINT);
AMORPHOUS_ARMOR_CLOUD(4109, POINT),
MORPH_OBSERVER_SIEGE(4116, NONE),
MORPH_OBSERVER_UNSIEGE(4115, NONE),
MORPH_OVERSEER_SIEGE(4117, NONE),
MORPH_OVERSEER_UNSIEGE(4118, NONE);

public static final class Other implements Ability {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,15 @@ public enum Upgrades implements Upgrade {
DIGGING_CLAWS(293),
CARRIER_CARRIER_CAPACITY(294),
CARRIER_LEASH_RANGE_UPGRADE(295),
TEMPEST_GROUND_ATTACK_UPGRADE(296),
HURRICANE_THRUSTERS(296),
TEMPEST_GROUND_ATTACK_UPGRADE(297),
MICROBIAL_SHROUD(298),
INTERFERENCE_MATRIX(299),
ENHANCED_SHOCKWAVES(304),
HURRICANE_THRUSTERS(-1000); //-1000 is arbitrary id. It's 296, but 296 is taken in older versions
SUNDERING_IMPACT(300),
AMPLIFIED_SHIELDING(301),
PSIONIC_AMPLIFIERS(302),
SECRETED_COATING(303),
ENHANCED_SHOCKWAVES(304);

public static final class Other implements Upgrade {

Expand Down Expand Up @@ -370,7 +374,7 @@ public String toString() {
EnumSet.allOf(Upgrades.class).forEach(upgrade -> upgradeIdMap.put(upgrade.getUpgradeId(), upgrade));
}

private int upgradeId;
private final int upgradeId;

Upgrades(int upgradeId) {
this.upgradeId = upgradeId;
Expand All @@ -380,21 +384,6 @@ public static Upgrade from(int sc2ApiUpgradeId) {
return Optional.ofNullable(upgradeIdMap.get(sc2ApiUpgradeId)).orElse(Other.of(sc2ApiUpgradeId));
}

public static void remapForBuild(Integer build) {
if (build >= 91115) {
updateId(296, 297);
updateId(-1000, 296);
}
}

private static void updateId(int oldId, int newId) {
Upgrade toUpdate = upgradeIdMap.remove(oldId);
if (toUpdate != null) {
((Upgrades) toUpdate).upgradeId = newId;
upgradeIdMap.put(newId, toUpdate);
}
}

@Override
public int getUpgradeId() {
return upgradeId;
Expand Down

0 comments on commit 9b47d31

Please sign in to comment.