Пример #1
0
        public virtual void InvalidateGate()
        {
            if (Battle == null || Battle.State == PvPBattleState.Internal || !Battle.QueueAllowed || GateLocation.Internal ||
                GateLocation.Zero)
            {
                if (Gate == null)
                {
                    return;
                }

                Gate.Delete();
                Gate = null;
                return;
            }

            if (Gate == null || Gate.Deleted)
            {
                Gate = new PvPTeamGate(this);

                if (GateLocation.MoveToWorld(Gate))
                {
                    Gate.MoveToWorld(GateLocation, GateLocation);
                }
            }

            if (Gate.Team == null)
            {
                Gate.Team = this;
            }
        }
Пример #2
0
        public virtual void Serialize(GenericWriter writer)
        {
            var version = writer.SetVersion(6);

            if (version > 4)
            {
                writer.WriteBlock(
                    w =>
                {
                    if (version > 5)
                    {
                        Serial.Serialize(w);
                    }
                    else
                    {
                        w.WriteType(Serial, t => Serial.Serialize(w));
                    }
                });
            }

            switch (version)
            {
            case 6:
            case 5:
            case 4:
            case 3:
                writer.Write(RespawnOnStart);
                goto case 2;

            case 2:
                writer.Write(KickOnDeath);
                goto case 1;

            case 1:
            {
                GateLocation.Serialize(writer);
                writer.Write(Gate);
            }
                goto case 0;

            case 0:
            {
                writer.Write(_Name);
                writer.Write(_MinCapacity);
                writer.Write(_MaxCapacity);
                writer.Write(_Color);
                writer.Write(_HomeBase);
                writer.Write(_SpawnPoint);

                writer.Write(RespawnOnDeath);
                writer.Write(RespawnDelay);

                writer.WriteBlock(w => w.WriteType(Statistics));
            }
            break;
            }
        }