/// <summary>
        /// Produces a shift value offset that can be used to
        /// map the provided <see cref="containerFieldValue"/> to the
        /// <see cref="EContainerFields"/> for wotlk.
        /// </summary>
        /// <param name="containerFieldValue">The container field value to shift.</param>
        /// <param name="shiftValue">The value of the shift.</param>
        /// <returns>Indicates if the value should be written. This return is important. Don't write it if this returns false.</returns>
        public static bool ConvertUpdateFieldsContainer(EContainerFields_Vanilla containerFieldValue, out int shiftValue)
        {
            //Only need a static shift amount. 3.3.5 has more fields but we just don't write them
            shiftValue = (int)EContainerFields.CONTAINER_FIELD_NUM_SLOTS - (int)EContainerFields_Vanilla.CONTAINER_FIELD_NUM_SLOTS;

            return(true);
        }
コード例 #2
0
        public static void Test_ConvertUpdateFieldContainer_Converts_All_Values([Range((int)EItemFields_Vanilla.ITEM_END, (int)EContainerFields_Vanilla.CONTAINER_END - 1)] int fieldNumber)
        {
            //arrange
            EContainerFields_Vanilla vanillaContainerField = (EContainerFields_Vanilla)fieldNumber;

            //act
            bool?result     = null;
            int  shiftValue = 0;

            Assert.DoesNotThrow(() => result = VanillaToWotlkConverter.ConvertUpdateFieldsContainer(vanillaContainerField, out shiftValue), $"Field: {fieldNumber}:{vanillaContainerField}:{fieldNumber:X} is not converted.");
            int newFieldNumber = (shiftValue + fieldNumber);

            //Assert
            Assert.NotNull(result);
            Assert.True(newFieldNumber >= (int)EItemFields.ITEM_END && newFieldNumber <= (int)EContainerFields.CONTAINER_END, $"Failed for {fieldNumber}:0x{fieldNumber:X}:{((EContainerFields_Vanilla)fieldNumber).ToString()}");
        }