public LootTable getLootTableForChestType(ChestType chestType, [Optional, DefaultParameterValue(0)] int rollNo)
        {
            if (chestType == ChestType.RewardBoxMulti)
            {
                switch (rollNo)
                {
                case 0:
                    return(this.MegaboxSlot1LootTable);

                case 1:
                    return(this.MegaboxSlot2LootTable);

                case 2:
                    return(this.MegaboxSlot3LootTable);
                }
                return(this.MegaboxSlot1LootTable);
            }
            if (chestType == ChestType.MysterySpecialOffer)
            {
                ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon;
                if ((activeDungeon != null) && (activeDungeon.ActiveTournament != null))
                {
                    return(this.ChestLootTables[ChestType.MysterySpecialOffer_BossHunt]);
                }
            }
            if (ConfigMeta.IsBossChest(chestType))
            {
                return(this.prepareDynamicChestTable(chestType));
            }
            return(this.ChestLootTables[chestType]);
        }
Beispiel #2
0
        public void AddChest(ChestType typeOfChest, Point chestLocation)
        {
            switch (typeOfChest)
            {
            case ChestType.BoneBox:
                BoneBox++;
                break;

            case ChestType.FetishJar:
                FetishJar++;
                break;

            case ChestType.CursedChest:
                CursedChest++;
                break;
            }

            if (chestLocation.Y < GroupLocation.Y)
            {
                GroupLocation.Y = chestLocation.Y;
            }
            if (chestLocation.X < GroupLocation.X)
            {
                GroupLocation.X = chestLocation.X;
            }
        }
Beispiel #3
0
 private void CreateGreen()
 {
     numItems = r.Next(1, 20);
     if (numItems > 16)
     {
         numItems = 3;
     }
     else if (numItems > 8)
     {
         numItems = 2;
     }
     else
     {
         numItems = 1;
     }
     items    = new GameObject[numItems];
     tipo     = ChestType.green;
     items[0] = ItemArrays.commonItems[0];
     for (int i = 1; i < numItems; i++)
     {
         int next = r.Next(0, 20);
         if (next > 19)
         {
             items[i] = ItemArrays.legendItems[r.Next(0, ItemArrays.legendItems.Length)];
         }
         else if (next > 14)
         {
             items[i] = ItemArrays.rareItems[r.Next(0, ItemArrays.rareItems.Length)];
         }
         else
         {
             items[i] = ItemArrays.commonItems[r.Next(0, ItemArrays.commonItems.Length)];
         }
     }
 }
Beispiel #4
0
 public void Generate(ChestType type)
 {
     r = Generator.r;
     //just to instantiate with different numbers n shit
     if (type == ChestType.golden)
     {
         CreateGolden();
     }
     else if (type == ChestType.purple)
     {
         CreatePurple();
     }
     else if (type == ChestType.blue)
     {
         CreateBlue();
     }
     else if (type == ChestType.green)
     {
         CreateGreen();
     }
     else
     {
         CreateBrown();
     }
 }
Beispiel #5
0
 private void CreateBrown()
 {
     numItems = r.Next(1, 20);
     if (numItems > 15)
     {
         numItems = 2;
     }
     else
     {
         numItems = 1;
     }
     items    = new GameObject[numItems];
     tipo     = ChestType.brown;
     items[0] = ItemArrays.commonItems[0];
     for (int i = 1; i < numItems; i++)
     {
         int next = r.Next(0, 40);
         if (next > 39)
         {
             items[i] = ItemArrays.legendItems[r.Next(0, ItemArrays.legendItems.Length)];
         }
         else if (next > 31)
         {
             items[i] = ItemArrays.rareItems[r.Next(0, ItemArrays.rareItems.Length)];
         }
         else
         {
             items[i] = ItemArrays.commonItems[r.Next(0, ItemArrays.commonItems.Length)];
         }
     }
 }
Beispiel #6
0
 private void CreateBlue()
 {
     numItems = r.Next(1, 10);
     if (numItems > 5)
     {
         numItems = 3;
     }
     else
     {
         numItems = 2;
     }
     items    = new GameObject[numItems];
     tipo     = ChestType.blue;
     items[0] = ItemArrays.commonItems[0];
     for (int i = 1; i < numItems; i++)
     {
         int next = r.Next(0, 20);
         if (next > 18)
         {
             items[i] = ItemArrays.legendItems[r.Next(0, ItemArrays.legendItems.Length)];
         }
         else if (next > 12)
         {
             items[i] = ItemArrays.rareItems[r.Next(0, ItemArrays.rareItems.Length)];
         }
         else
         {
             items[i] = ItemArrays.commonItems[r.Next(0, ItemArrays.commonItems.Length)];
         }
     }
 }
        private static ChestType DropTableRoll(LootTable dropLootTable, Player player, string predefinedDropRollId)
        {
            LootTableItem item;
            ChestType     nONE = ChestType.NONE;

            ModifyDropTableWeights(dropLootTable, player);
            if (!string.IsNullOrEmpty(predefinedDropRollId))
            {
                LootTableItem item2 = new LootTableItem();
                item2.Id = predefinedDropRollId;
                item     = item2;
            }
            else
            {
                item = dropLootTable.roll();
            }
            if ((item != null) && (item.Id != "NO_DROP"))
            {
                try
                {
                    nONE = (ChestType)((int)Enum.Parse(typeof(ChestType), item.Id));
                }
                catch (Exception)
                {
                    UnityEngine.Debug.LogError("Cannot parse ChestType enum from boss chest loot table roll: " + item.Id);
                }
            }
            dropLootTable.resetWeights(true);
            return(nONE);
        }
 private void CheckForChest()
 {
     chestType = (ChestType)EditorGUILayout.EnumPopup("Chest Type", chestType);
     if (myChest)
     {
         if (chestType != selectedType)
         {
             DestroyImmediate(myChest);
         }
     }
     selectedType = chestType;
     if (!myChest)
     {
         if (chestType == ChestType.Small)
         {
             SetupChest("Small");
         }
         else if (chestType == ChestType.Medium)
         {
             SetupChest("Medium");
         }
         else if (chestType == ChestType.Large)
         {
             SetupChest("Large");
         }
         else
         {
             DestroyImmediate(myChest);
         }
     }
 }
    public Chest(int Randomnumber)
    {
        Type       = (ChestType)Randomnumber;
        coins      = 0;
        gems       = 0;
        timetoOpen = 0;
        switch (Type)
        {
        case ChestType.Common:
            coins      = UnityEngine.Random.Range(100, 201);
            gems       = UnityEngine.Random.Range(10, 21);
            timetoOpen = 900;
            break;

        case ChestType.Rare:
            coins      = UnityEngine.Random.Range(300, 501);
            gems       = UnityEngine.Random.Range(20, 41);
            timetoOpen = 1800;
            break;

        case ChestType.Epic:
            coins      = UnityEngine.Random.Range(600, 801);
            gems       = UnityEngine.Random.Range(45, 61);
            timetoOpen = 3600;
            break;

        case ChestType.Legendary:
            coins      = UnityEngine.Random.Range(1000, 1201);
            gems       = UnityEngine.Random.Range(80, 100);
            timetoOpen = 10800;
            break;
        }
    }
Beispiel #10
0
 public override void Start()
 {
     base.Start();
     opened  = false;
     spriteR = gameObject.GetComponent <SpriteRenderer>();
     Type    = (ChestType)Random.Range(0, 3);
     Physics2D.IgnoreLayerCollision(0, 16);
 }
Beispiel #11
0
 public Chest(int chestId, Point coordinates)
 {
     this.activeChest = true;
     this.chestId = chestId;
     this.coordinates = coordinates;
     this.items = new List<Item>();
     this.chestType = ChestType.Unknown;
 }
Beispiel #12
0
 public CmdRollChestLootTable(ChestType chestType, Player player, bool isBossDrop, ref Reward reward, [Optional, DefaultParameterValue(null)] List <ShopEntryType> disallowedShopEntryTypes)
 {
     this.m_chestType  = chestType;
     this.m_player     = player;
     this.m_isBossDrop = isBossDrop;
     this.m_reward     = reward;
     this.m_disallowedShopEntryTypes = disallowedShopEntryTypes;
 }
Beispiel #13
0
 public ChestRewardData(ChestType chestType, int gems, int coins, RewardCardData[] rewardCards, WShopChestRewardData rewardRange)
 {
     this.chestType   = chestType;
     this.gems        = gems;
     this.coins       = coins;
     this.rewardCards = rewardCards;
     this.rewardRange = rewardRange;
 }
Beispiel #14
0
 public void Initialize()
 {
     currentHealth        = maxHealth;
     currentChestType     = ChestType.Normal;
     currentChestPosessed = null;
     isDead   = false;
     isHiding = false;
 }
Beispiel #15
0
 public Chest(int chestId, Point coordinates)
 {
     this.activeChest = true;
     this.chestId     = chestId;
     this.coordinates = coordinates;
     this.items       = new List <Item>();
     this.chestType   = ChestType.Unknown;
 }
Beispiel #16
0
    public void SetChestType(ChestType type)
    {
        currentChestType = type;

        if (OnChestTypeChange != null)
        {
            OnChestTypeChange();
        }
    }
Beispiel #17
0
 public void ResetChest()
 {
     aS.volume = 0.1f;
     aS.PlayOneShot(close);
     chestType        = oldType;
     isopen           = false;
     messageDisplayed = false;
     ator.SetBool("Open", false);
 }
Beispiel #18
0
 public void InitializeValues(Chest random)
 {
     Type       = random.Type;
     coins      = random.coins;
     gems       = random.gems;
     timetoOpen = random.timetoOpen;
     islocked   = true;
     ResetChest();
 }
        public static CustomChest ToCustomChest(this Chest chest, ChestType chestType)
        {
            var customChest = CustomChestFactory.Create(chestType);

            customChest.items.AddRange(chest.items);
            customChest.playerChoiceColor.Value = chest.playerChoiceColor.Value;
            customChest.name  = chest.name;
            customChest.Stack = chest.Stack;
            return(customChest);
        }
Beispiel #20
0
        public int getNumberOfItemsInSpecialChests()
        {
            int num = 0;

            for (int i = 0; i < ConfigMeta.BOSS_CHESTS_SPECIAL.Length; i++)
            {
                ChestType type = ConfigMeta.BOSS_CHESTS_SPECIAL[i];
                num += this.m_dynamicChestLootTables[type].Items.Count;
            }
            return(num);
        }
    public override object ReadJson(Type type, Dictionary <string, object> value)
    {
        Dictionary <ChestType, LootTable> dictionary = new Dictionary <ChestType, LootTable>();

        foreach (KeyValuePair <string, object> pair in value)
        {
            ChestType key = (ChestType)((int)Enum.Parse(typeof(ChestType), pair.Key));
            dictionary.Add(key, JsonReader.CoerceType <LootTable>(pair.Value));
        }
        return(dictionary);
    }
Beispiel #22
0
    public override object ReadJson(Type type, Dictionary <string, object> value)
    {
        Dictionary <ChestType, int> dictionary = new Dictionary <ChestType, int>();

        foreach (KeyValuePair <string, object> pair in value)
        {
            ChestType key = (ChestType)((int)Enum.Parse(typeof(ChestType), pair.Key));
            dictionary.Add(key, int.Parse(pair.Value.ToString()));
        }
        return(dictionary);
    }
Beispiel #23
0
 public void copyFrom(Item another)
 {
     this.Id            = another.Id;
     this.Name          = another.Name;
     this.Type          = another.Type;
     this.Accessories   = another.Accessories;
     this.Rarity        = another.Rarity;
     this.SpriteId      = another.SpriteId;
     this.BodyMaterials = another.BodyMaterials;
     this.Description   = another.Description;
     this.FixedPerks    = new PerkContainer(another.FixedPerks);
     this.FromChest     = another.FromChest;
 }
        public static CustomChest Create(ChestType chestType)
        {
            switch (chestType)
            {
            case ChestType.LargeChest:
                return(new LargeChest());

            case ChestType.MagicChest:
                return(new MagicChest());

            default:
                throw new InvalidOperationException("Invalid ChestType");
            }
        }
Beispiel #25
0
            public EventMissions(RemotePromotion remotePromotion)
            {
                this.Instances = new List <ConfigPromotionEvents.EventMissionInstance>();
                EventParams parsedCustomParams = remotePromotion.ParsedCustomParams as EventParams;

                this.BigPrizeDescription     = remotePromotion.ParsedLoca.PopupMissionsBigPrize;
                this.BigPrizeRewardChestType = parsedCustomParams.Missions.BigPrizeRewardChestType;
                this.BigPrizeSprite          = parsedCustomParams.Missions.BigPrizeSprite;
                this.Instances = parsedCustomParams.Missions.Instances;
                for (int i = 0; (i < this.Instances.Count) && (i < remotePromotion.ParsedLoca.PopupMissions.Count); i++)
                {
                    this.Instances[i].setInfo(remotePromotion.ParsedLoca.PopupMissions[i]);
                }
            }
Beispiel #26
0
 public RobeItem(ItemRarities rarity, double color = -1, double itemType = -1) : base(rarity, ItemTypes.Robe, "robe")
 {
     color = color < 0 ? Globals.Random.NextDouble() : color;
     if (color < 0.25)
     {
         Name          = $"{rarity} Red Robe";
         AnimationFile = "Zerds/red-robe.png";
     }
     else if (color < 0.5)
     {
         Name          = $"{rarity} Blue Robe";
         AnimationFile = "Zerds/blue-robe.png";
     }
     else if (color < 0.7)
     {
         Name          = $"{rarity} Green Robe";
         AnimationFile = "Zerds/green-robe.png";
     }
     else if (color < 0.9)
     {
         Name          = $"{rarity} Purple Robe";
         AnimationFile = "Zerds/purple-robe.png";
     }
     else
     {
         Name          = $"{rarity} Dark Robe";
         AnimationFile = "Zerds/dark-robe.png";
     }
     itemType = itemType < 0 ? Globals.Random.NextDouble() : itemType;
     if (itemType < 0.5)
     {
         _chestItemType      = ChestType.Knockback;
         KnockbackReduction  = 0.05f + 0.03f * (int)rarity;
         KnockbackReduction *= 0.9f + (float)Globals.Random.NextDouble() * 0.2f;
     }
     else
     {
         _chestItemType = ChestType.Thorns;
         Thorns         = 1 + (int)rarity;
         if (itemType < 0.65)
         {
             Thorns++;
         }
         else if (itemType < 0.8 && Thorns > 1)
         {
             Thorns--;
         }
     }
 }
    //  public Prize prize;

    public SaveableChest(int chestID, ChestState chestState, DateTimeSaveable openOrderTimeArg, DateTimeSaveable openDurationArg, ChestType chestType)
    {
        this.chestType             = chestType;
        this.chestID               = chestID;
        this.chestState            = chestState;
        openDurationSaveable       = openDurationArg;
        this.openOrderTimeInSystem = new DateTime(openOrderTimeArg.year, openOrderTimeArg.month, openOrderTimeArg.day, openOrderTimeArg.hour, openOrderTimeArg.minute, openOrderTimeArg.seconds);
        this.openDurationSaveable  = openDurationArg;
        //  this.prize = prize;

        openDuration = new TimeSpan(openDurationArg.hour, openDurationArg.minute, openDurationArg.seconds);

//        Debug.Log( " sss  " + openDuration);
        // openOrderTimeSaveable = new DateTimeSaveable(0, 0, 0, openOrderTimeInSystem.Hour, openOrderTimeInSystem.Minute, openOrderTimeInSystem.Second);
    }
Beispiel #28
0
    /// <summary>
    /// 下棋的方法
    /// </summary>
    /// <param name="pos"> 棋子的位置</param>
    public void PlayChest(int[] pos)
    {
        if (!gamestart)
        {
            Debug.Log("游戏结束了");
            return;
        }
        if (pos[0] > 14 || pos[0] < 0)
        {
            return;
        }
        if (pos[1] > 14 || pos[1] < 0)
        {
            return;
        }
        if (grid[pos[0], pos[1]] != 0)
        {
            return;
        }

        //黑棋下棋
        switch (turn)
        {
        case ChestType.white:
            GameObject whiteChest = Instantiate(prefebs[1], new Vector3(pos[0] - 7, pos[1] - 7, 0), Quaternion.identity);

            whiteChest.transform.SetParent(GameObject.Find("White").transform);
            grid[pos[0], pos[1]] = 1;
            whiteStack.Push(whiteChest);
            break;

        case ChestType.black:
            GameObject blackChest = Instantiate(prefebs[0], new Vector3(pos[0] - 7, pos[1] - 7, 0), Quaternion.identity);

            blackChest.transform.SetParent(GameObject.Find("Black").transform);
            grid[pos[0], pos[1]] = 2;
            blackStack.Push(blackChest);
            break;

        default:
            break;
        }
        CheckOneLineWin(pos, 1, 0);
        CheckOneLineWin(pos, 0, 1);
        CheckOneLineWin(pos, 1, 1);
        CheckOneLineWin(pos, 1, -1);
        turn = (turn == ChestType.white) ? ChestType.black : ChestType.white;
    }
        private LootTable prepareDynamicChestTable(ChestType chestType)
        {
            LootTable table = GameLogic.Binder.ItemResources.getDynamicChestLootTable(chestType);

            for (int i = 0; i < table.Items.Count; i++)
            {
                LootTableItem lti   = table.Items[i];
                Item          item2 = GameLogic.Binder.ItemResources.getItemForLootTableRollId(lti.Id, ItemType.UNSPECIFIED);
                if (item2 != null)
                {
                    int weight = App.Binder.ConfigLootTables.UniversalItemRarityWeights[item2.Rarity];
                    table.setWeightForItem(lti, weight);
                }
            }
            return(table);
        }
Beispiel #30
0
        public bool DrawMarker(ChestType type)
        {
            if (type == ChestType.Unknown)
            {
                return(false);
            }

            String chestType = Global.Instance.Info.MarkerImageToName(Enum.GetName(typeof(ChestType), type));

            if (this.settings.MarkerStates.ContainsKey(chestType))
            {
                return(this.settings.MarkerStates[chestType].Drawing);
            }

            return(false);
        }
    private void OnEnable()
    {
        float randNum = Random.Range(0, 1);

        spriteRenderer = GetComponent <SpriteRenderer>();

        if (randNum <= 0.8f)
        {
            type = ChestType.normal;
        }
        else
        {
            type = ChestType.locked;
            GetComponent <Animator>().runtimeAnimatorController = lockChestAnimator;
        }
    }
Beispiel #32
0
 public Chest()
 {
     this.chestId = 0;
     this.items = new List<Item>();
     this.chestType = ChestType.Unknown;
 }
Beispiel #33
0
        public bool DrawMarker(ChestType type)
        {
            if (type == ChestType.Unknown)
                return false;

            String chestType = Global.Instance.Info.MarkerImageToName(Enum.GetName(typeof(ChestType), type));

            if (this.settings.MarkerStates.ContainsKey(chestType))
                return this.settings.MarkerStates[chestType].Drawing;

            return false;
        }