public LootBoxElement(int width, int height, GraphicsDevice device, GUI gui, string rarity, LootBox loot) : base(width,
                                                                                                                         height, device, gui)
        {
            using (FileStream fileStream = new FileStream("Content/Lootbox/" + rarity + ".png", FileMode.Open))
            {
                Texture = Texture2D.FromStream(Game1.self.GraphicsDevice, fileStream);
                fileStream.Dispose();
            }

            Scale   = new Vector2((float)width / (float)Texture.Width, (float)height / (float)Texture.Height);
            Lootbox = loot;

            if (rarity.Equals("common"))
            {
                this.rarity = Rarity.common;
            }
            else if (rarity.Equals("uncommon"))
            {
                this.rarity = Rarity.uncommon;
            }
            else if (rarity.Equals("rare"))
            {
                this.rarity = Rarity.rare;
            }
            Tooltip = new Tooltip(400, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true, 300);

            Tooltip.Text = "Name:    " + Lootbox.Name + "\n" + "Rarity:    " + rarity + "\n" + "Cost:    " + Lootbox.Cost;
        }
Exemplo n.º 2
0
        public static string ValidateLootbox(LootBox lootbox)
        {
            if (string.IsNullOrWhiteSpace(lootbox.Name))
            {
                return(FailureReasons.VALUE_NOT_IN_RANGE + "name");
            }
            if (lootbox.Cost < 0)
            {
                return(FailureReasons.VALUE_NOT_IN_RANGE + "cost");
            }
            if (lootbox.NumberOfShips <= 0)
            {
                return(FailureReasons.VALUE_NOT_IN_RANGE + "number of ships");
            }
            double chancesSum = 0.0;

            foreach (var entry in lootbox.ChancesForRarities)
            {
                if (entry.Value < 0)
                {
                    return(FailureReasons.VALUE_NOT_IN_RANGE + "chance for " + entry.Key.GetRarityName());
                }
                chancesSum += entry.Value;
            }
            if (!chancesSum.IsEqualWithTolerance(1.0, 0.00001))
            {
                return(FailureReasons.VALUE_NOT_IN_RANGE + "chances do not sum up to 1.0");
            }
            return(OK);
        }
Exemplo n.º 3
0
        public void Parse(ICLIFlags toolFlags)
        {
            var unlocks = GetUnlocks();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(unlocks, flags);
                    return;
                }
            }

            ListHeroUnlocks.DisplayUnlocks("Other", unlocks.OtherUnlocks);

            if (unlocks.LootBoxesUnlocks != null)
            {
                foreach (LootBoxUnlocks lootBoxUnlocks in unlocks.LootBoxesUnlocks)
                {
                    string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType);

                    ListHeroUnlocks.DisplayUnlocks(boxName, lootBoxUnlocks.Unlocks);
                }
            }

            if (unlocks.AdditionalUnlocks != null)
            {
                foreach (AdditionalUnlocks additionalUnlocks in unlocks.AdditionalUnlocks)
                {
                    ListHeroUnlocks.DisplayUnlocks($"Level {additionalUnlocks.Level}", additionalUnlocks.Unlocks);
                }
            }
        }
Exemplo n.º 4
0
    protected void Die()
    {
        Instantiate(fixedParticleEffect, transform.position + Vector3.up * 0.5f, Quaternion.identity);

        rigidbody2d.simulated = false;

        xpAmount -= (CalculateDamage() / 2);
        CharacterSheet.charSheet.ChangeXP(xpAmount);
        GameEvents.OnXpAwarded();

        audioSource.Stop();
        audioSource.PlayOneShot(hitSound);

        List <string> tags = (List <string>)gameObject.GetComponent <CustomTags>().GetTags();

        tags.Add(gameObject.tag);

        if (Random.Range(0, 3) == 1 || GetComponent <CustomTags>().HasTag("Wyrm"))
        {
            LootBox box = Instantiate(lootboxPrefab, gameObject.transform.position, Quaternion.identity);
            box.CreateLootbox(itemDrops, coinAmount);
        }

        Destroy(this.gameObject);
        GameEvents.OnKillSuccessful(tags);
    }
Exemplo n.º 5
0
        public static Game ReadFrom(System.IO.BinaryReader reader)
        {
            var result = new Game();

            result.CurrentTick = reader.ReadInt32();
            result.Properties  = Properties.ReadFrom(reader);
            result.Level       = Level.ReadFrom(reader);
            result.Players     = new Player[reader.ReadInt32()];
            for (int i = 0; i < result.Players.Length; i++)
            {
                result.Players[i] = Player.ReadFrom(reader);
            }
            result.Units = new Unit[reader.ReadInt32()];
            for (int i = 0; i < result.Units.Length; i++)
            {
                result.Units[i] = Unit.ReadFrom(reader);
            }
            result.Bullets = new Bullet[reader.ReadInt32()];
            for (int i = 0; i < result.Bullets.Length; i++)
            {
                result.Bullets[i] = Bullet.ReadFrom(reader);
            }
            result.Mines = new Mine[reader.ReadInt32()];
            for (int i = 0; i < result.Mines.Length; i++)
            {
                result.Mines[i] = Mine.ReadFrom(reader);
            }
            result.LootBoxes = new LootBox[reader.ReadInt32()];
            for (int i = 0; i < result.LootBoxes.Length; i++)
            {
                result.LootBoxes[i] = LootBox.ReadFrom(reader);
            }
            return(result);
        }
Exemplo n.º 6
0
    private void CreateLootBox()
    {
        int         itemAmountForLootBox = Random.Range(minItemInLootBox, maxItemInLootBox);
        List <Item> itemsForLootBox      = new List <Item>();

        while (creatingItemsForLootBox < itemAmountForLootBox)
        {
            randomItemNumber = Random.Range(1, inventoryItemList.itemList.Count - 1);
            int raffle = Random.Range(1, 100);

            if (raffle <= inventoryItemList.itemList[randomItemNumber].rarity)
            {
                itemsForLootBox.Add(inventoryItemList.itemList[randomItemNumber].getCopy());
                creatingItemsForLootBox++;
            }
        }
        if (itemsForLootBox.Count == 0)
        {
            return;
        }
        Vector3 posLootBox = transform.position;

        posLootBox.y = 0.5f;
        GameObject lootBox = Instantiate(LootBox, posLootBox, transform.rotation);;
        LootBox    sI      = LootBox.GetComponent <LootBox>();

        sI.storageItems.Clear();
        for (int i = 0; i < itemsForLootBox.Count; i++)
        {
            sI.storageItems.Add(inventoryItemList.getItemByID(itemsForLootBox[i].itemID));

            int randomValue = Random.Range(1, sI.storageItems[sI.storageItems.Count - 1].maxStack);
            sI.storageItems[sI.storageItems.Count - 1].itemValue = randomValue;
        }
    }
Exemplo n.º 7
0
        public static LootBox ReadFrom(System.IO.BinaryReader reader)
        {
            var result = new LootBox();

            result.Position = Model.Vec2Double.ReadFrom(reader);
            result.Size     = Model.Vec2Double.ReadFrom(reader);
            result.Item     = Model.Item.ReadFrom(reader);
            return(result);
        }
Exemplo n.º 8
0
            private async Task Open(InventoryWrapper inventory, LootBox variety, int count)
            {
                StringBuilder text    = new StringBuilder();
                IUserMessage  message = null;

                if (count > 1)
                {
                    string m = string.Concat(Enumerable.Repeat(variety.Emote.ToString() + "\n", count));
                    message = await ReplyAsync(m);

                    await Task.Delay(1000);
                }

                for (int i = 0; i < count; i++)
                {
                    var box = variety.Open(Context.Bot, 0);
                    if (count == 1)
                    {
                        message = await ReplyAsync(variety.Emote.ToString());

                        await Task.Delay(1000);

                        StringBuilder animation = new StringBuilder();

                        foreach (var(rarity, emoji) in box)
                        {
                            animation.Append($"{rarity.LeftBracket}❔{rarity.RightBracket}");
                        }
                        await message.ModifyAsync(m => m.Content = animation.ToString());

                        await Task.Delay(1000);

                        animation.Clear();
                    }

                    foreach (var(rarity, emoji) in box)
                    {
                        var trans = Transaction.FromLootbox(marketId: 0, buyer: inventory.UserId, variety.Name);

                        inventory.Add(new Models.Emoji
                        {
                            Owner        = Context.User.Id,
                            Transactions = new List <TransactionInfo>()
                            {
                                Context.Bot.Clerk.Queue(trans).Receive()
                            },
                            Unicode = emoji
                        }, true);

                        text.Append($"{rarity.LeftBracket}{emoji}{rarity.RightBracket}");
                    }
                    text.AppendLine();
                }

                inventory.Save();
                await message.ModifyAsync(m => m.Content = text.ToString());
            }
Exemplo n.º 9
0
    private void Start()
    {
        LootBox box = FindObjectOfType <LootBox>();

        if (box)
        {
            box.OnBoxOpen += GetChestItems;
        }
    }
Exemplo n.º 10
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <string, ProgressionUnlocks> unlocks = GetUnlocks();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    if (flags.Flatten)
                    {
                        var @out = unlocks.ToDictionary(x => x.Key, x => x.Value.IterateUnlocks());
                        OutputJSON(@out, flags);
                    }
                    else
                    {
                        OutputJSON(unlocks, flags);
                    }

                    return;
                }
            }

            foreach (KeyValuePair <string, ProgressionUnlocks> heroPair in unlocks)
            {
                Log("Unlocks for {0}", heroPair.Key);

                if (heroPair.Value.LevelUnlocks != null)
                {
                    foreach (LevelUnlocks levelUnlocks in heroPair.Value.LevelUnlocks)
                    {
                        DisplayUnlocks("Default", levelUnlocks.Unlocks);
                    }
                }

                if (heroPair.Value.OtherUnlocks != null)
                {
                    var owlUnlocks   = heroPair.Value.OtherUnlocks.Where(u => u.STU.m_0B1BA7C1 != null).ToArray();
                    var otherUnlocks = heroPair.Value.OtherUnlocks.Where(u => u.STU.m_0B1BA7C1 == null).ToArray();
                    DisplayUnlocks("Other", otherUnlocks);
                    DisplayUnlocks("OWL", owlUnlocks);
                }

                if (heroPair.Value.LootBoxesUnlocks != null)
                {
                    foreach (LootBoxUnlocks lootBoxUnlocks in heroPair.Value.LootBoxesUnlocks)
                    {
                        string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType);

                        DisplayUnlocks(boxName, lootBoxUnlocks.Unlocks);
                    }
                }

                Log(); // New line
            }
        }
Exemplo n.º 11
0
    private void ShowTooltip(LootBox lootBox)
    {
        tooltipWindow.alpha          = 1;
        tooltipWindow.interactable   = true;
        tooltipWindow.blocksRaycasts = true;

        itemName.text        = lootBox.GetItem().name;
        itemSellPrice.text   = new Money(lootBox.GetItem().sellPrice).ToString();
        itemDescription.text = ItemDescription(lootBox.GetItem());
        itemType.text        = lootBox.GetItem().itemType.ToString();
    }
Exemplo n.º 12
0
    public LootSafe Initialize(string apiUrl, string apiKey)
    {
        balance = gameObject.AddComponent <Balance>().Initialize(apiUrl);
        crafter = gameObject.AddComponent <Crafter>().Initialize(apiUrl);
        events  = gameObject.AddComponent <Events>().Initialize(apiUrl);
        general = gameObject.AddComponent <General>().Initialize(apiUrl);
        items   = gameObject.AddComponent <Items>().Initialize(apiUrl);
        lootbox = gameObject.AddComponent <LootBox>().Initialize(apiUrl);

        return(this);
    }
Exemplo n.º 13
0
        public void CreateLootBox(Vector position, Reward reward, Types type, int disposeMs)
        {
            var id   = GetNextObjectId();
            var hash = HashedObjects.Keys.ToList()[id];
            var box  = new LootBox(id, hash, type, position, this, reward, disposeMs);

            HashedObjects[hash] = box;
            if (AddObject(box))
            {
                Out.WriteLog("Created LootBox [" + type + "] on mapId " + Id);
            }
        }
Exemplo n.º 14
0
        public void GetLootboxes(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }


            foreach (ulong key in TrackedFiles[0xCF])
            {
                STULootBox lootbox = GetInstance <STULootBox>(key);
                if (lootbox == null)
                {
                    continue;
                }

                string name = LootBox.GetName(lootbox.m_lootboxType);

                Combo.ComboInfo info = Combo.Find(null, lootbox.m_baseEntity); // 003
                Combo.Find(info, lootbox.m_chestEntity);                       // 003
                Combo.Find(info, lootbox.m_idleEffect);                        // 00D
                Combo.Find(info, lootbox.m_FEC3ED62);                          // 00D
                Combo.Find(info, lootbox.m_FFE7768F);                          // 00D
                Combo.Find(info, lootbox.m_baseModelLook);                     // 01A
                Combo.Find(info, lootbox.m_modelLook);

                Combo.Find(info, 0x400000000001456); // coin chest, todo
                // 00000000315A.00C in 000000001456.003 (288230376151716950)

                if (lootbox.m_shopCards != null)
                {
                    foreach (STULootBoxShopCard lootboxShopCard in lootbox.m_shopCards)
                    {
                        Combo.Find(info, lootboxShopCard.m_cardTexture); // 004
                    }
                }

                var context = new SaveLogic.Combo.SaveContext(info);
                SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(basePath, Container, name, "ShopCards"), context);
                SaveLogic.Combo.Save(flags, Path.Combine(basePath, Container, name), context);
                context.Wait();
                SaveScratchDatabase();
            }
        }
Exemplo n.º 15
0
        public void GetGeneralUnlocks(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }

            string path = Path.Combine(basePath, "General");

            foreach (var key in TrackedFiles[0x54])
            {
                STUGenericSettings_PlayerProgression progression = GetInstance <STUGenericSettings_PlayerProgression>(key);
                if (progression == null)
                {
                    continue;
                }

                PlayerProgression playerProgression = new PlayerProgression(progression);

                if (playerProgression.LootBoxesUnlocks != null)
                {
                    foreach (LootBoxUnlocks lootBoxUnlocks in playerProgression.LootBoxesUnlocks)
                    {
                        string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType);
                        ExtractHeroUnlocks.SaveUnlocks(flags, lootBoxUnlocks.Unlocks, path, boxName, null, null, null, null);
                    }
                }

                if (playerProgression.AdditionalUnlocks != null)
                {
                    foreach (AdditionalUnlocks additionalUnlocks in playerProgression.AdditionalUnlocks)
                    {
                        ExtractHeroUnlocks.SaveUnlocks(flags, additionalUnlocks.Unlocks, path, "Standard", null, null, null, null);
                    }
                }

                if (playerProgression.OtherUnlocks != null)
                {
                    ExtractHeroUnlocks.SaveUnlocks(flags, playerProgression.OtherUnlocks, path, "Achievement", null, null, null, null);
                }

                SaveScratchDatabase();
            }
        }
Exemplo n.º 16
0
    public void OnDrag(PointerEventData eventData)
    {
        if (!ItemInSlot)
        {
            return;
        }

        if (isLootBox)
        {
            LootBox lootBox = (LootBox)dataProvider.Player.ClosesActionObject;

            lootBox.RemoveItem(ItemInSlot, SlotID);
        }

        ItemImage.transform.position = eventData.position;
    }
Exemplo n.º 17
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "LootBox")
        {
            lb = col.GetComponent <LootBox>();
            if (!lb.IsPressed)
            {
                useCase.SetActive(true);
                anim.SetBool("useCase", true);
                canUse = true;
            }
            else
            {
                canUse = false;
            }
        }
        if (col.tag == "ZombieDrop")
        {
            int id = col.GetComponent <ZombieDrop>().DropIndex;
            switch (id)
            {
            case 0:
                int ammo = minMoneyDrop * currentDay;
                if (currentGunShooter.ammoLeft + ammo <= currentGunShooter.maxAmmo)
                {
                    currentGunShooter.ammoLeft += ammo;
                }
                else
                {
                    currentGunShooter.ammoLeft = currentGunShooter.maxAmmo;
                }
                break;

            case 1:
                int gold = Random.Range(minMoneyDrop, maxMoneyDrop) * currentDay;
                money += gold;
                break;

            case 2:
                GetComponent <Heals>().CurrentHeals += 10;
                break;
            }
            Destroy(col.gameObject);
        }
    }
Exemplo n.º 18
0
        public string GetRarity(LootBox loot)
        {
            string result = "0";

            if (loot.Name.Equals("basic lootbox"))
            {
                result = "common";
            }
            if (loot.Name.Equals("better lootbox"))
            {
                result = "uncommon";
            }
            if (loot.Name.Equals("supreme lootbox"))
            {
                result = "rare";
            }
            return(result);
        }
Exemplo n.º 19
0
    private void DropAndDeadProcess()
    {
        //실질적인 드랍이 이루어지도록 한다.
        CoinManager.PopCoin(transform.position, dropCoinCount);

        if (dropItem != null)
        {
            LootBox lb = Instantiate(lootBoxPrefab, transform.position, Quaternion.identity);
            lb.SetLootItem(dropItem);
            lb.Popup(transform.position);

            //여기에 보스의 HP바를 지워주는 걸 해주면 된다.

            UIManager.HideBossHPBar();

            gameObject.SetActive(false);
        }
    }
Exemplo n.º 20
0
        private async Task <int> CreateLootBox(CreateItemCommand request, CancellationToken cancellationToken)
        {
            var requiresKey = request.RequiresKey == "true" ? true : false;

            var treasure = new LootBox
            {
                Name            = request.Name,
                Type            = request.BoxType,
                RequiresKey     = requiresKey,
                RewardAmplifier = request.RewardAmplifier,
                ImagePath       = this.imagePath.Process(new string[] { "Item", request.Slot, request.Name }),
                Slot            = request.Slot,
            };

            this.Context.LootBoxes.Add(treasure);

            await this.Context.SaveChangesAsync(cancellationToken);

            return(treasure.Id);
        }
        public LootBoxElement(int width, int height, GraphicsDevice device, GUI gui, string rarity, LootBox loot) : base(width,
                                                                                                                         height, device, gui)
        {
            Lootbox = loot;

            if (rarity.Equals("common"))
            {
                AssetManager z = Game.Activity.Assets;
                z.Open("Loots/Common.png");

                using (var fileStream = Game.Activity.Assets.Open("Loots/Common.png"))
                {
                    Texture = Texture2D.FromStream(Game1.self.GraphicsDevice, fileStream);
                    fileStream.Dispose();
                }
                this.rarity = Rarity.common;
            }
            else if (rarity.Equals("uncommon"))
            {
                using (var fileStream = Game.Activity.Assets.Open("Loots/Uncommon.png"))
                {
                    Texture = Texture2D.FromStream(Game1.self.GraphicsDevice, fileStream);
                    fileStream.Dispose();
                }
                this.rarity = Rarity.uncommon;
            }
            else if (rarity.Equals("rare"))
            {
                using (var fileStream = Game.Activity.Assets.Open("Loots/Rare.png"))
                {
                    Texture = Texture2D.FromStream(Game1.self.GraphicsDevice, fileStream);
                    fileStream.Dispose();
                }
                this.rarity = Rarity.rare;
            }

            Scale   = new Vector2((float)width / (float)Texture.Width, (float)height / (float)Texture.Height);
            Tooltip = new Tooltip(400, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true, 300);

            Tooltip.Text = "Name:    " + Lootbox.Name + "\n" + "Rarity:    " + rarity + "\n" + "Cost:    " + Lootbox.Cost;
        }
Exemplo n.º 22
0
 // On click to OpenBox, looks at how many items are in the box and adds an Item.
 public void OpenBox()
 {
     if (User.user.LootBoxes > 0)
     {
         LootBox lootBox = GenerateLootBox();
         if (User.user.inventory.Count + lootBox.ItemCount > User.user.InventorySlots)
         {
             errorText.enabled = true;
             errorText.text    = "Your inventory is too full!";
             StartCoroutine(DisableErrorText());
             return;
         }
         for (int i = 0; i < lootBox.ItemCount; i++)
         {
             GameObject thisObject = lootManager.lootSlots[i].gameObject;
             ClearItemSprites(thisObject);
             CreateLoot(thisObject, thisObject.GetComponent <Image>());
         }
         User.user.Experience += lootBox.Experience;
         if (User.user.Experience >= User.user.ExperienceToNext)
         {
             LevelUp levelUp = new LevelUp();
             levelUp.IncreaseLevel(playerLevelText, firebaseManager);
         }
         if (User.user.LootBoxes == User.user.MaxLootBoxes)
         {
             firebaseManager.UpdateLastTimeOpenedLootBox();
         }
         User.user.LootBoxes  -= 1;
         User.user.Experience += lootBox.Experience;
         firebaseManager.UpdateDatabaseValues();
     }
     else
     {
         errorText.enabled = true;
         errorText.text    = "You do not have any more loot boxes!";
         StartCoroutine(DisableErrorText());
     }
     //DataManager.dataManager.Save();
 }
Exemplo n.º 23
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <string, ProgressionUnlocks> unlocks = GetUnlocks();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(unlocks, flags);
                    return;
                }
            }

            foreach (KeyValuePair <string, ProgressionUnlocks> heroPair in unlocks)
            {
                Log("Unlocks for {0}", heroPair.Key);

                if (heroPair.Value.LevelUnlocks != null)
                {
                    foreach (LevelUnlocks levelUnlocks in heroPair.Value.LevelUnlocks)
                    {
                        DisplayUnlocks("Default", levelUnlocks.Unlocks);
                    }
                }

                DisplayUnlocks("Other", heroPair.Value.OtherUnlocks);

                if (heroPair.Value.LootBoxesUnlocks != null)
                {
                    foreach (LootBoxUnlocks lootBoxUnlocks in heroPair.Value.LootBoxesUnlocks)
                    {
                        string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType);

                        DisplayUnlocks(boxName, lootBoxUnlocks.Unlocks);
                    }
                }
            }
        }
Exemplo n.º 24
0
    //Buy a new lootbox of the given "loot" type
    public void BuyLootBox(LootBox loot)
    {
        string shortCode = "";

        switch (loot)
        {
        case LootBox.SkinRelic:
            shortCode = "SkinRelic";
            break;

        case LootBox.CharacterBlueprint:
            shortCode = "CharacterBlueprint";
            break;

        case LootBox.TimeCapsule:
            shortCode = "TimeCapsule";
            break;

        default:
            break;
        }
        new GameSparks.Api.Requests.BuyVirtualGoodsRequest()
        .SetCurrencyType(1)
        .SetQuantity(1)
        .SetShortCode(shortCode)
        .Send((response) => {
            if (!response.HasErrors)
            {
                GetGoods();
                GetTokens();
            }
            else
            {
                //TODO: add error handling
            }
        });
    }
Exemplo n.º 25
0
    //Unlocks a given type of loot box of a given index
    public void Unlock(LootBox loot, int index)
    {
        string shortCode = "";

        switch (loot)
        {
        case LootBox.SkinRelic:
            shortCode = "SkinRelic";
            playerData.SkinUnlocks[index] = true;
            break;

        case LootBox.CharacterBlueprint:
            shortCode = "CharacterBlueprint";
            playerData.SkinUnlocks[index] = true;
            break;

        case LootBox.TimeCapsule:
            shortCode = "TimeCapsule";
            playerData.CharUnlocks[index] = true;
            break;
        }
        SavePlayerData();
        new GameSparks.Api.Requests.ConsumeVirtualGoodRequest()
        .SetQuantity(1)
        .SetShortCode(shortCode)
        .Send((response) => {
            if (!response.HasErrors)
            {
                LoadPlayerData();
            }
            else
            {
                //TODO: add error handling
            }
        });
    }
Exemplo n.º 26
0
        public void SaveUnlocksForHeroes(ICLIFlags flags, IEnumerable <STUHero> heroes, string basePath, bool npc = false)
        {
            if (flags.Positionals.Length < 4)
            {
                QueryHelp(QueryTypes);
                return;
            }

            Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides);

            if (parsedTypes == null)
            {
                return;
            }

            foreach (STUHero hero in heroes)
            {
                if (hero == null)
                {
                    continue;
                }
                string heroNameActual = GetString(hero.m_0EDCE350);

                if (heroNameActual == null)
                {
                    continue;
                }

                Dictionary <string, ParsedArg> config = GetQuery(parsedTypes, heroNameActual.ToLowerInvariant(), "*");

                heroNameActual = heroNameActual.TrimEnd(' ');
                string heroFileName = GetValidFilename(heroNameActual);

                if (config.Count == 0)
                {
                    continue;
                }

                string heroPath = Path.Combine(basePath, RootDir, heroFileName);

                VoiceSet           voiceSet           = new VoiceSet(hero);
                ProgressionUnlocks progressionUnlocks = new ProgressionUnlocks(hero);
                if (progressionUnlocks.LevelUnlocks == null && !npc)
                {
                    continue;
                }
                if (progressionUnlocks.LootBoxesUnlocks != null && npc)
                {
                    continue;
                }

                Log($"Processing unlocks for {heroNameActual}");

                {
                    Combo.ComboInfo guiInfo = new Combo.ComboInfo();

                    foreach (STU_1A496D3C tex in hero.m_8203BFE1)
                    {
                        Combo.Find(guiInfo, tex.m_texture);
                        guiInfo.SetTextureName(tex.m_texture, teResourceGUID.AsString(tex.m_id));
                    }

                    SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(heroPath, "GUI"), guiInfo);
                }

                if (progressionUnlocks.OtherUnlocks != null)   // achievements and stuff
                {
                    Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> {
                        { "event", new TagExpectedValue("base") }
                    };
                    SaveUnlocks(flags, progressionUnlocks.OtherUnlocks, heroPath, "Achievement", config, tags, voiceSet, hero);
                }

                if (npc)
                {
                    foreach (var skin in hero.m_skinThemes)
                    {
                        if (!config.ContainsKey("skin") || !config["skin"].ShouldDo(GetFileName(skin.m_5E9665E3)))
                        {
                            continue;
                        }
                        SkinTheme.Save(flags, Path.Combine(heroPath, Unlock.GetTypeName(typeof(STUUnlock_SkinTheme)),
                                                           string.Empty, GetFileName(skin.m_5E9665E3)), skin, hero);
                    }
                    continue;
                }

                if (progressionUnlocks.LevelUnlocks != null)   // default unlocks
                {
                    Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> {
                        { "event", new TagExpectedValue("base") }
                    };
                    foreach (LevelUnlocks levelUnlocks in progressionUnlocks.LevelUnlocks)
                    {
                        SaveUnlocks(flags, levelUnlocks.Unlocks, heroPath, "Default", config, tags, voiceSet, hero);
                    }
                }

                if (progressionUnlocks.LootBoxesUnlocks != null)
                {
                    foreach (LootBoxUnlocks lootBoxUnlocks in progressionUnlocks.LootBoxesUnlocks)
                    {
                        if (lootBoxUnlocks.Unlocks == null)
                        {
                            continue;
                        }
                        string lootboxName = LootBox.GetName(lootBoxUnlocks.LootBoxType);

                        var tags = new Dictionary <string, TagExpectedValue> {
                            { "event", new TagExpectedValue(LootBox.GetBasicName(lootBoxUnlocks.LootBoxType)) }
                        };

                        SaveUnlocks(flags, lootBoxUnlocks.Unlocks, heroPath, lootboxName, config, tags, voiceSet, hero);
                    }
                }
            }
        }
Exemplo n.º 27
0
    public void OpenLootBox(LootBox lootBox)
    {
        LootData loot = lootBox.GetLoot();

        Debug.Log(loot);
    }
Exemplo n.º 28
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (!ItemInSlot)
        {
            return;
        }

        LootBox lootBox = null;

        if (eventData.hovered.Count > 0)
        {
            //  print(eventData.hovered[0]);

            bool check = false;
            int  indx  = 0;


            foreach (var c in eventData.hovered)
            {
                if (c.gameObject.GetComponent <InventoryItemSlot>())
                {
                    check = true;
                    break;
                }
                indx++;
            }

            Debug.Log("Ui invebtory check ststus: " + check);

            if (check)
            {
                InventoryItemSlot targetslot = eventData.hovered[indx].GetComponent <InventoryItemSlot>();

                if (ItemInSlot.Equiped && !targetslot.ItemInSlot && !targetslot.isLootBox)
                {
                    Inventory inventory = dataProvider.Player.Inventory;
                    ItemInSlot.Equiped = false;
                    inventory.UnEquipItem(ItemInSlot);
                }

                if (targetslot.ItemInSlot)
                {
                    ItemImage.transform.localPosition = oldPos;
                }
                else
                {
                    if (!targetslot.isLootBox)
                    {
                        ItemInSlot.gameObject.SetActive(false);

                        dataProvider.Player.Inventory.AddItemToList(ItemInSlot);


                        print("Change item position:  " + ItemInSlot.name);


                        if (targetslot.SlotID == 10)
                        {
                            Inventory inventory = dataProvider.Player.Inventory;
                            ItemInSlot.Equiped = true;
                            inventory.EquipItem(ItemInSlot);
                        }


                        targetslot.ItemInSlot       = ItemInSlot;
                        targetslot.ItemImage.sprite = ItemImage.sprite;
                        ItemInSlot       = null;
                        ItemImage.sprite = dataProvider.BattleUI.emptySprite;
                        ItemImage.transform.localPosition = oldPos;
                    }
                    else
                    {
                        ItemImage.transform.localPosition = oldPos;
                    }
                }
            }
            else
            {
                Debug.Log("DropItem_2");
                ItemImage.transform.localPosition = oldPos;
            }
        }
        else
        {
            Debug.Log("DropItem_3");

            if (isLootBox)
            {
                lootBox = (LootBox)dataProvider.Player.ClosesActionObject;

                if (lootBox)
                {
                    lootBox.RemoveItem(ItemInSlot);
                }
            }
            else
            {
                dataProvider.Player.Inventory.RemovItemFromList(ItemInSlot);
            }

            ItemInSlot.gameObject.transform.position = dataProvider.Player.ItemDropPoint.position;
            ItemInSlot.transform.SetParent(null);
            ItemInSlot.gameObject.SetActive(true);
            Inventory inventory = dataProvider.Player.Inventory;
            ItemInSlot.Equiped = false;
            inventory.UnEquipItem(ItemInSlot);

            ItemInSlot       = null;
            ItemImage.sprite = dataProvider.BattleUI.emptySprite;
            ItemImage.transform.localPosition = oldPos;
        }
    }
Exemplo n.º 29
0
    private void ShowTooltip(LootBox lootBox)
    {
        tooltipWindow.alpha = 1;
        tooltipWindow.interactable = true;
        tooltipWindow.blocksRaycasts = true;

        itemName.text = lootBox.GetItem().name;
        itemSellPrice.text = new Money(lootBox.GetItem().sellPrice).ToString();
        itemDescription.text = ItemDescription(lootBox.GetItem());
        itemType.text = lootBox.GetItem().itemType.ToString();
    }
Exemplo n.º 30
0
 private void OnEnable()
 {
     chest = (LootBox)target;
 }
 public void DestroyLootBox(LootBox lootBox)
 {
     activeLootBoxes.Remove(lootBox.GetComponent <LootBox>());
     RemoveLootBoxFromTile(lootBox);
     Destroy(lootBox.gameObject);
 }