Пример #1
0
        /// <summary>
        /// Called when the game begins
        /// </summary>
        public bool gameStart()
        {       //We've started!
            _tickGameStart      = Environment.TickCount;
            _tickGameStarting   = 0;
            _tickLastReadyCheck = 0;
            _tickLastShrink     = Environment.TickCount;
            _victoryTeam        = null;
            _baseScript.AllowPrivateTeams(false, 1);
            _activeTeams.Clear();

            List <ItemInfo> removes = AssetManager.Manager.getItems.Where(itm => itm.name.EndsWith("(BR)")).ToList();

            foreach (Player player in _arena.Players)
            {
                foreach (ItemInfo item in removes)
                {
                    if (player.getInventoryAmount(item.id) > 0)
                    {
                        player.removeAllItemFromInventory(item.id);
                    }
                }
            }

            //Let everyone know
            _arena.sendArenaMessage("Game has started!", 1);

            List <short> spawnPoints = new List <short>();
            short        maxLeft     = 1920;
            short        maxRight    = 30832;
            short        center      = 16488;
            short        separation  = 3000; //previously 1500
            short        current     = 0;

            int teamCountSansRedBlue = _arena.ActiveTeams.Count();

            if (_arena.getTeamByName("Red").ActivePlayerCount > 0)
            {
                teamCountSansRedBlue--;
            }
            if (_arena.getTeamByName("Blue").ActivePlayerCount > 0)
            {
                teamCountSansRedBlue--;
            }

            short requiredSpace = (short)(teamCountSansRedBlue * separation);

            while (true)
            {
                current = (short)_rand.Next(maxLeft, maxRight);

                if (current + requiredSpace > maxRight)
                {
                    continue;
                }

                break;
            }

            foreach (Team team in _arena.ActiveTeams)
            {
                if (team._name == "Red" || team._name == "Blue") // Skip Red vs Blue for spawning
                {
                    continue;
                }

                //Find a good location to spawn
                short pX = current, pY = 1744;

                //Spawn each player around this point
                foreach (Player player in team.ActivePlayers)
                {
                    if (bClassic)
                    {
                        player.resetSkills();
                        player.skillModify(true, _classSkill, 1);
                    }
                    player.warp(pX, pY);
                    player.inventoryModify(203, 2);

                    if (player.Bounty < 1000)
                    {
                        player.Bounty = 1000;
                    }
                }

                spawnPoints.Add(current);
                _activeTeams.Add(team);

                current += separation;
            }

            //Start up the storm!
            _storm = new Boundary(_arena, 104, 3624, (short)(spawnPoints.Last() + 800), (short)(spawnPoints.First() - 800));
            _arena.setTicker(1, 3, 60 * 100, "Play area shrinking in: ");

            //Clear flags
            _arena.flagReset();

            //Hide some loot boxes
            if (bClassic)
            {
                hideLootBoxes(_playersPerTeam, spawnPoints);
            }
            return(true);
        }