Пример #1
0
        public static void StartHorde()
        {
            currentIndex++;
            if (currentIndex >= HordeDef.GetAll().Count())
            {
                currentIndex = 0;
            }

            StartHorde(HordeDef.GetAll().ElementAt(currentIndex));
        }
Пример #2
0
        public static bool StartHorde(string name)
        {
            HordeDef def = HordeDef.GetDef(name);

            if (def == null)
            {
                return(false);
            }

            StartHorde(def);

            return(true);
        }
Пример #3
0
        public static void ReadGameInfo(PacketReader stream)
        {
            string name = stream.ReadString();

            activeDef = HordeDef.GetDef(name);
            HordePhase phase = (HordePhase)stream.ReadByte();

            if (phase == HordePhase.Stand)
            {
                int index = stream.ReadByte();
                StartStand(activeDef.Stands[index]);
            }
            else
            {
                Endstand();
            }
            SetPhase(phase);
        }
Пример #4
0
        public static void ReadStartMessage(PacketReader stream)
        {
            string name = stream.ReadString();

            activeDef = HordeDef.GetDef(name);
        }
Пример #5
0
        public static void StartHorde(HordeDef def)
        {
            if (def == null)
            {
                return;
            }

            Log.Logger.Log("horde init");

            ArenaClient.ForEach(c =>
            {
                var client         = (ArenaClient)c;
                client.HordeScore  = 0;
                client.HordeDeaths = 0;
                client.HordeKills  = 0;
                client.HordeClass  = null;
            });
            players.ForEach(c => c.Spectate());
            players.Clear();

            if (activeWorld != null)
            {
                activeWorld.BaseWorld.ForEachVob(v => v.Despawn());
            }

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.HordeStart);
            stream.Write(def.Name);
            ArenaClient.ForEach(c => c.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered));

            activeDef   = def;
            activeWorld = WorldInst.List.Find(w => w.Path == def.WorldPath);

            spawnBarriers.Clear();
            foreach (var bar in activeDef.SpawnBarriers)
            {
                if (!bar.AddAfterEvent)
                {
                    spawnBarriers.Add(CreateBarrier(bar));
                }
            }

            ActiveStands.Clear();
            for (int i = 0; i < activeDef.Stands.Length; i++)
            {
                var       stand = activeDef.Stands[i];
                StandInst inst  = new StandInst()
                {
                    Index = i,
                    Stand = stand,
                };

                if (stand.Boss != null)
                {
                    inst.Boss            = SpawnEnemy(stand.Boss, stand.Position);
                    inst.Boss.CanGetHit += BossProtection;
                }

                inst.Barriers = new List <VobInst>(stand.Barriers.Length);
                foreach (var bar in stand.Barriers)
                {
                    if (!bar.AddAfterEvent)
                    {
                        inst.Barriers.Add(CreateBarrier(bar));
                    }
                }

                ActiveStands.Add(inst);
            }

            foreach (var hi in activeDef.Items)
            {
                ItemInst item = new ItemInst(ItemDef.Get(hi.ItemDef));
                item.Spawn(activeWorld, hi.Position, hi.Angles);
            }

            standEnemyCount = 0;
            ActiveStandInst = null;

            gameTimer.SetInterval(30 * TimeSpan.TicksPerSecond);
            gameTimer.SetCallback(Start);
            gameTimer.Stop();

            SetPhase(HordePhase.WarmUp);
        }