Exemple #1
0
        public static async Task <InventoryDef[]> GetDefinitionsWithPricesAsync()
        {
            var priceRequest = await Internal.RequestPrices();

            if (!priceRequest.HasValue || priceRequest.Value.Result != Result.OK)
            {
                return(null);
            }

            Currency = priceRequest?.CurrencyUTF8();

            var num = Internal.GetNumItemsWithPrices();

            if (num <= 0)
            {
                return(null);
            }

            var defs          = new InventoryDefId[num];
            var currentPrices = new ulong[num];
            var baseprices    = new ulong[num];

            var gotPrices = Internal.GetItemsWithPrices(defs, currentPrices, baseprices, num);

            if (!gotPrices)
            {
                return(null);
            }

            return(defs.Select(x => new InventoryDef(x)).ToArray());
        }
Exemple #2
0
        internal static InventoryDef[] GetDefinitions()
        {
            uint num = 0;

            if (!Internal.GetItemDefinitionIDs(null, ref num))
            {
                return(null);
            }

            var defs = new InventoryDefId[num];

            if (!Internal.GetItemDefinitionIDs(defs, ref num))
            {
                return(null);
            }

            return(defs.Select(x => new InventoryDef(x)).ToArray());
        }