Ejemplo n.º 1
0
        public void HandleLootBoxes(PSXAPI.Response.Lootbox[] boxes)
        {
            if (boxes != null)
            {
                for (int i = 0; i < boxes.Length; i++)
                {
                    if (boxes[i].Remaining > 0 && boxes[i].Action != PSXAPI.Response.LootboxAction.Opened)
                    {
                        Lootboxes.Add(boxes[i]);
                    }

                    if (boxes[i].Type == PSXAPI.Response.LootboxType.Normal)
                    {
                        NormalBoxes = boxes[i].Remaining;
                    }
                    else if (boxes[i].Type == PSXAPI.Response.LootboxType.Small)
                    {
                        SmallBoxes = boxes[i].Remaining;
                    }
                    if (boxes[i].Action == PSXAPI.Response.LootboxAction.Opened)
                    {
                        if (boxes[i].Rolls != null)
                        {
                            Rewards = boxes[i].Rolls;
                            BoxOpened?.Invoke(Rewards, boxes[i].Type);
                        }
                    }
                }
            }
            // PokeOne's way....
            int count = (int)(NormalBoxes + SmallBoxes - oldAmount);

            if (count > (long)((ulong)oldAmount))
            {
                LootBoxMessage?.Invoke("You gained Loot Box x" + count + ".");
                RecievedBox?.Invoke(this);
            }
            TotalLootBoxes = (int)(NormalBoxes + SmallBoxes);

            oldAmount = NormalBoxes + SmallBoxes;
            UpdateFreeLootBox();
        }
Ejemplo n.º 2
0
        public void HandleLootBoxes(PSXAPI.Response.Lootbox[] boxes)
        {
            if (boxes != null)
            {
                for (int i = 0; i < boxes.Length; i++)
                {
                    if (boxes[i].Type == PSXAPI.Response.LootboxType.Normal)
                    {
                        NormalBoxes = boxes[i].Remaining;
                    }
                    else if (boxes[i].Type == PSXAPI.Response.LootboxType.Small)
                    {
                        SmallBoxes = boxes[i].Remaining;
                    }

                    if (boxes[i].Action == PSXAPI.Response.LootboxAction.Opened)
                    {
                        if (boxes[i].Rolls != null)
                        {
                            Rewards = boxes[i].Rolls;
                            BoxOpened?.Invoke(Rewards, boxes[i].Type);
                        }
                    }
                    else if (boxes[i].Action == PSXAPI.Response.LootboxAction.Update)
                    {
                        if (boxes[i].Remaining > 0)
                        {
                            RecievedBox?.Invoke(boxes[i]);
                        }
                    }
                }
            }
            // PokeOne's way....
            TotalLootBoxes = (int)(NormalBoxes + SmallBoxes);

            oldAmount = NormalBoxes + SmallBoxes;
            UpdateFreeLootBox();
        }