コード例 #1
0
        public void HandleTeleportMap(WorldClient client, GMTeleportMapPacket packet)
        {
            if (!_gameSession.IsAdmin)
            {
                return;
            }

            if (!_gameWorld.AvailableMapIds.Contains(packet.MapId))
            {
                _packetFactory.SendGmCommandError(client, PacketType.GM_TELEPORT_MAP);
                return;
            }

            float x     = 100;
            float y     = 100;
            float z     = 100;
            var   spawn = _mapLoader.LoadMapConfiguration(packet.MapId).Spawns.FirstOrDefault(s => ((int)s.Faction == 1 && _countryProvider.Country == CountryType.Light) || ((int)s.Faction == 2 && _countryProvider.Country == CountryType.Dark));

            if (spawn != null)
            {
                x = spawn.Area.LowerLimit.X;
                y = spawn.Area.LowerLimit.Y;
                z = spawn.Area.LowerLimit.Z;
            }

            _packetFactory.SendGmCommandSuccess(client);

            _teleportationManager.Teleport(packet.MapId, x, y, z, true);
        }
コード例 #2
0
        private void HandleGMTeleportToMap(GMTeleportMapPacket gmTeleportMapPacket)
        {
            if (!_gameWorld.Maps.ContainsKey(gmTeleportMapPacket.MapId))
            {
                _packetsHelper.SendGmCommandError(Client, PacketType.GM_TELEPORT_MAP);
                return;
            }

            _packetsHelper.SendGmCommandSuccess(Client);

            // TODO: Use fixed xz coordinates per map?
            Teleport(gmTeleportMapPacket.MapId, 100, PosY, 100, true);
        }
コード例 #3
0
        private void HandleGMTeleportToMap(GMTeleportMapPacket gmTeleportMapPacket)
        {
            var mapId = gmTeleportMapPacket.MapId;

            if (!_gameWorld.AvailableMapIds.Contains(mapId))
            {
                _packetsHelper.SendGmCommandError(Client, PacketType.GM_TELEPORT_MAP);
                return;
            }

            float x     = 100;
            float z     = 100;
            var   spawn = _mapLoader.LoadMapConfiguration(mapId).Spawns.FirstOrDefault(s => (s.Faction == 1 && Country == Fraction.Light) || (s.Faction == 2 && Country == Fraction.Dark));

            if (spawn != null)
            {
                x = spawn.X1;
                z = spawn.Z1;
            }

            _packetsHelper.SendGmCommandSuccess(Client);

            Teleport(mapId, x, PosY, z, true);
        }