Ejemplo n.º 1
0
        public void FixAllValues(EnumTranslator enumTranslator, EnumTranslator.TranslationMode mode)
        {
            if (enumTranslator == null)
            {
                return;
            }
            EnumTranslator.FixEnumValues(enumTranslator, mode, identifiableData);
            EnumTranslator.FixEnumValues(enumTranslator, mode, playerData);
            EnumTranslator.FixEnumValues(enumTranslator, mode, customAmmo);
            EnumTranslator.FixEnumValues(enumTranslator, mode, worldData);
            var newDict = new Dictionary <AmmoIdentifier, List <VanillaAmmoData> >();

            long FixValue(AmmoType type, long original)
            {
                switch (type)
                {
                case AmmoType.PLAYER:
                    return((int)enumTranslator.TranslateEnum(typeof(PlayerState.AmmoMode), mode, (PlayerState.AmmoMode)(int) original));

                case AmmoType.LANDPLOT:
                    return((int)enumTranslator.TranslateEnum(typeof(SiloStorage.StorageType), mode, (SiloStorage.StorageType)(int) original));
                }
                return(original);
            }

            foreach (var v in customAmmo)
            {
                newDict[new AmmoIdentifier(v.Key.AmmoType, FixValue(v.Key.AmmoType, v.Key.longIdentifier), v.Key.stringIdentifier, v.Key.custommodid)] = v.Value;
            }
            customAmmo = newDict;
            EnumTranslator.FixEnumValues(enumTranslator, mode, extendedData);
            EnumTranslator.FixEnumValues(enumTranslator, mode, extendedWorldData);
        }
Ejemplo n.º 2
0
 static ModPlayerData()
 {
     EnumTranslator.RegisterEnumFixer(
         (EnumTranslator translator, EnumTranslator.TranslationMode mode, ModPlayerData data) =>
     {
         EnumTranslator.FixEnumValues(translator, mode, data.upgrades);
         EnumTranslator.FixEnumValues(translator, mode, data.availBlueprints);
         EnumTranslator.FixEnumValues(translator, mode, data.blueprints);
         EnumTranslator.FixEnumValues(translator, mode, data.blueprintLocks);
         EnumTranslator.FixEnumValues(translator, mode, data.availUpgrades);
         EnumTranslator.FixEnumValues(translator, mode, data.upgradeLocks);
         EnumTranslator.FixEnumValues(translator, mode, data.progress);
         EnumTranslator.FixEnumValues(translator, mode, data.craftMatCounts);
         EnumTranslator.FixEnumValues(translator, mode, data.delayedProgress);
         EnumTranslator.FixEnumValues(translator, mode, data.gadgets);
         EnumTranslator.FixEnumValues(translator, mode, data.mail);
         EnumTranslator.FixEnumValues(translator, mode, data.unlockedZoneMaps);
     });
     EnumTranslator.RegisterEnumFixer(
         (EnumTranslator translator, EnumTranslator.TranslationMode mode, MailV02 data) =>
     {
         data.mailType = EnumTranslator.TranslateEnum(translator, mode, data.mailType);
     }
         );
 }
Ejemplo n.º 3
0
 public DataIdentifier TranslateWithEnum(EnumTranslator translator, EnumTranslator.TranslationMode mode)
 {
     if (Type != IdentifierType.EXCHANGEOFFER)
     {
         return(this);
     }
     return(new DataIdentifier()
     {
         Type = Type, longID = (int)translator.TranslateEnum(mode, (ExchangeDirector.OfferType)(int) longID), stringID = stringID
     });
 }