Esempio 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);
        }
Esempio n. 2
0
 public void FixAllEnumValues(EnumTranslator.TranslationMode mode)
 {
     foreach (var v in segments)
     {
         v.FixAllValues(mode);
     }
 }
Esempio 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
     });
 }
Esempio n. 4
0
 public void FixAllValues(EnumTranslator.TranslationMode mode)
 {
     Debug.Log("trying to fix " + modid);
     if (enumTranslator == null)
     {
         return;
     }
     Debug.Log("going to fix it all");
     EnumTranslator.FixEnumValues(enumTranslator, mode, identifiableData);
     EnumTranslator.FixEnumValues(enumTranslator, mode, playerData);
     EnumTranslator.FixEnumValues(enumTranslator, mode, customAmmo);
 }
Esempio n. 5
0
 public void FixAllEnumValues(EnumTranslator.TranslationMode mode)
 {
     enumTranslator?.FixEnumValues(mode, partialData);
     if (enumTranslator != null)
     {
         var newDict = new Dictionary <DataIdentifier, PartialData>();
         foreach (var v in partialData)
         {
             newDict.Add(v.Key.TranslateWithEnum(enumTranslator, mode), v.Value);
         }
         partialData = newDict;
     }
     enumTranslator?.FixEnumValues(mode, appearancesData);
     enumTranslator?.FixEnumValues(mode, ammoDataEntries);
     foreach (var v in segments)
     {
         v.FixAllValues(enumTranslator, mode);
     }
 }
Esempio n. 6
0
 public MissingTranslationException(object value, EnumTranslator.TranslationMode mode)
 {
     this.value = value;
     this.mode  = mode;
 }