public static byte GetType(ChestTypeAttribute.ChestType chestType, AppearanceType appearanceType) { var type = (byte)chestType; type <<= 2; type += (byte)appearanceType; return(type); }
/// <summary> /// Get chest type override for ice trap based on appearance setting. /// </summary> /// <param name="appearance">Ice trap appearance setting</param> /// <param name="random">Random</param> /// <returns>Chest type.</returns> public static ChestTypeAttribute.ChestType GetIceTrapChestTypeOverride(IceTrapAppearance appearance, Random random) { if (appearance == IceTrapAppearance.MajorItems) { return(ChestTypeAttribute.ChestType.LargeGold); } else if (appearance == IceTrapAppearance.JunkItems) { return(ChestTypeAttribute.ChestType.SmallWooden); } else { var choices = new ChestTypeAttribute.ChestType[] { ChestTypeAttribute.ChestType.LargeGold, ChestTypeAttribute.ChestType.SmallGold, ChestTypeAttribute.ChestType.SmallWooden, }; return(choices[random.Next(choices.Length)]); } }