Example #1
0
        public List <MapItem> GetSpawns(TGenContext map)
        {
            int chosenAmount = Amount.Pick(map.Rand);

            RarityData rarity        = DataManager.Instance.UniversalData.Get <RarityData>();
            List <int> possibleItems = new List <int>();

            foreach (int baseSpecies in GetPossibleSpecies(map))
            {
                for (int ii = Rarity.Min; ii < Rarity.Max; ii++)
                {
                    Dictionary <int, List <int> > rarityTable;
                    if (rarity.RarityMap.TryGetValue(baseSpecies, out rarityTable))
                    {
                        if (rarityTable.ContainsKey(ii))
                        {
                            possibleItems.AddRange(rarityTable[ii]);
                        }
                    }
                }
            }

            List <MapItem> results = new List <MapItem>();

            if (possibleItems.Count > 0)
            {
                for (int ii = 0; ii < chosenAmount; ii++)
                {
                    int chosenItem = possibleItems[map.Rand.Next(possibleItems.Count)];
                    results.Add(new MapItem(chosenItem));
                }
            }

            return(results);
        }
Example #2
0
    public float CrntAtk()
    {
        if (_rarityData == null)
        {
            _rarityData = RarityDataTableObject.Instance.Table.All.FirstOrDefault(rarityData => rarityData.Rarity == "" + Rarity);
        }

        float crntAtk = CharacterLevelSystem.CalcLevelParameter(MinAtk, MaxAtk, _level, _rarityData.MaxLevel);

        return(crntAtk);
    }
Example #3
0
        /// <summary>
        /// Gets a random spell.
        /// </summary>
        public SpellData GetRandomSpell(RarityData Data)
        {
            int Count = this.Spells[Data.Instance].Count;

            if (Count > 0)
            {
                return(this.Spells[Data.Instance][XorShift.Next(Count)]);
            }

            Logging.Warning(this.GetType(), "GetRandomSpell() - No spell found for rarity: " + Data.Name);

            return(null);
        }
Example #4
0
        /// <summary>
        /// Gets a random spell.
        /// </summary>
        internal SpellData GetRandomSpell(XorShift Random, RarityData Data)
        {
            int Count = this.Spells[Data.Instance].Count;

            if (Count > 0)
            {
                return(this.Spells[Data.Instance][Random.Next(Count)]);
            }

            Logging.Info(this.GetType(), "GetRandomSpell() - No spell found for rarity: " + Data.Name);

            return(null);
        }
Example #5
0
        internal static void Execute(string Args, Player[] Players)
        {
            switch (Args)
            {
            case "Add Chest":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new AddChestCommand(true, Player.Arena, "???"));
                    }
                }

                break;
            }

            case "Add Spell":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        SpellSet   SpellSet = new SpellSet(Player.Arena, null);
                        RarityData Rarity   = (RarityData)CSV.Tables.Get(Gamefile.Rarity).Datas[Resources.Random.Next(CSV.Tables.Get(Gamefile.Rarity).Datas.Count - 1)];
                        SpellData  Data     = SpellSet.GetRandomSpell(Resources.Random, Rarity);

                        if (Data != null)
                        {
                            Player.GameMode.CommandManager.AddCommand(new AllianceUnitReceivedCommand("LogicDebug", Data));
                            break;
                        }
                    }
                }

                break;
            }

            case "Add 1000 Diamonds":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new DiamondsAddedCommand(1000));
                    }
                }

                break;
            }

            case "Add 10000 Diamonds":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new DiamondsAddedCommand(10000));
                    }
                }

                break;
            }

            case "Add 100000 Diamonds":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new DiamondsAddedCommand(100000));
                    }
                }

                break;
            }

            case "Remove 1000 Diamonds":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new TransactionsRevokedCommand(1000));
                    }
                }

                break;
            }

            case "Remove 10000 Diamonds":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new TransactionsRevokedCommand(10000));
                    }
                }

                break;
            }

            case "Remove 100000 Diamonds":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        Player.GameMode.CommandManager.AddCommand(new TransactionsRevokedCommand(100000));
                    }
                }

                break;
            }

            case "Unlock Spells":
            {
                foreach (Player Player in Players)
                {
                    if (Player.Connected)
                    {
                        foreach (SpellData Data in CSV.Tables.Spells)
                        {
                            if (!Player.Home.HasSpell(Data))
                            {
                                Player.GameMode.CommandManager.AddCommand(new AllianceUnitReceivedCommand("LogicDebug", Data));
                                Player.GameMode.CommandManager.AddCommand(new AllianceUnitReceivedCommand("LogicDebug", Data));
                            }
                        }
                    }
                }

                break;
            }
            }
        }
Example #6
0
        /// <summary>
        /// Creates the data for the specified row.
        /// </summary>
        /// <param name="Row">The row.</param>
        internal Data Create(Row Row)
        {
            Data Data;

            switch (this.Index)
            {
            case 1:
            {
                Data = new LocaleData(Row, this);
                break;
            }

            case 2:
            {
                Data = new BillingPackageData(Row, this);
                break;
            }

            case 3:
            case 20:
            {
                Data = new GlobalData(Row, this);
                break;
            }

            case 4:
            {
                Data = new SoundData(Row, this);
                break;
            }

            case 5:
            {
                Data = new ResourceData(Row, this);
                break;
            }

            case 9:
            {
                Data = new CharacterBuffData(Row, this);
                break;
            }

            case 10:
            {
                Data = new ProjectileData(Row, this);
                break;
            }

            case 11:
            {
                Data = new EffectData(Row, this);
                break;
            }

            case 12:
            {
                Data = new PredefinedDeckData(Row, this);
                break;
            }

            case 14:
            {
                Data = new RarityData(Row, this);
                break;
            }

            case 15:
            {
                Data = new LocationData(Row, this);
                break;
            }

            case 16:
            {
                Data = new AllianceBadgeData(Row, this);
                break;
            }

            case 18:
            {
                Data = new NpcData(Row, this);
                break;
            }

            case 19:
            {
                Data = new TreasureChestData(Row, this);
                break;
            }

            case 21:
            {
                Data = new ParticleEmitterData(Row, this);
                break;
            }

            case 22:
            {
                Data = new AreaEffectObjectData(Row, this);
                break;
            }

            case 26:
            case 27:
            case 28:
            case 29:
            {
                Data = new SpellData(Row, this);
                break;
            }

            case 34:
            case 35:
            {
                Data = new CharacterData(Row, this);
                break;
            }

            case 40:
            {
                Data = new HealthBarData(Row, this);
                break;
            }

            case 41:
            {
                Data = new MusicData(Row, this);
                break;
            }

            case 42:
            {
                Data = new DecoData(Row, this);
                break;
            }

            case 43:
            {
                Data = new GambleChestData(Row, this);
                break;
            }

            case 45:
            case 48:
            {
                Data = new TutorialData(Row, this);
                break;
            }

            case 46:
            {
                Data = new ExpLevelData(Row, this);
                break;
            }

            case 50:
            {
                Data = new BackgroundDecoData(Row, this);
                break;
            }

            case 51:
            {
                Data = new SpellSetData(Row, this);
                break;
            }

            case 52:
            {
                Data = new ChestOrderData(Row, this);
                break;
            }

            case 53:
            {
                Data = new TauntData(Row, this);
                break;
            }

            case 54:
            {
                Data = new ArenaData(Row, this);
                break;
            }

            case 55:
            {
                Data = new ResourcePackData(Row, this);
                break;
            }

            case 56:
            {
                Data = new Data(Row, this);
                break;
            }

            case 57:
            {
                Data = new RegionData(Row, this);
                break;
            }

            case 58:
            {
                Data = new NewsData(Row, this);
                break;
            }

            case 59:
            {
                Data = new AllianceRoleData(Row, this);
                break;
            }

            case 60:
            {
                Data = new AchievementData(Row, this);
                break;
            }

            case 61:
            {
                Data = new HintData(Row, this);
                break;
            }

            case 62:
            {
                Data = new HelpshiftData(Row, this);
                break;
            }

            default:
            {
                Logging.Info(this.GetType(), "Invalid data table id: " + this.Index + ".");
                Data = null;
                break;
            }
            }

            return(Data);
        }