public override Task ExecuteAsync(TeleportPacket teleportPacket, ClientSession session)
        {
            var targetSession =
                Broadcaster.Instance.GetCharacter(s =>
                                                  s.Name == teleportPacket.TeleportArgument); //TODO setter to protect

            if (!short.TryParse(teleportPacket.TeleportArgument, out var mapId))
            {
                if (targetSession != null)
                {
                    return(session.ChangeMapInstanceAsync(targetSession.MapInstanceId, targetSession.MapX,
                                                          targetSession.MapY));
                }

                _logger.Error(GameLanguage.Instance.GetMessageFromKey(LanguageKey.USER_NOT_CONNECTED,
                                                                      session.Account.Language));
                return(Task.CompletedTask);
            }

            var mapInstance = _mapInstanceAccessorService.GetBaseMapById(mapId);

            if (mapInstance != null)
            {
                return(session.ChangeMapAsync(mapId, teleportPacket.MapX, teleportPacket.MapY));
            }

            _logger.Error(
                GameLanguage.Instance.GetMessageFromKey(LanguageKey.MAP_DONT_EXIST, session.Account.Language));
            return(Task.CompletedTask);
        }
Esempio n. 2
0
        public List <Portal> GetMinilandPortals(long characterId)
        {
            var nosville    = _mapInstanceAccessorService.GetBaseMapById(1);
            var oldNosville = _mapInstanceAccessorService.GetBaseMapById(145);
            var miniland    = _mapInstanceAccessorService.GetMapInstance(_minilandHolder.Minilands[characterId].MapInstanceId);

            return(new List <Portal>
            {
                new Portal
                {
                    SourceX = 48,
                    SourceY = 132,
                    DestinationX = 5,
                    DestinationY = 8,
                    Type = PortalType.Miniland,
                    SourceMapId = 1,
                    DestinationMapId = 20001,
                    DestinationMapInstanceId = miniland !.MapInstanceId,
                    SourceMapInstanceId = nosville !.MapInstanceId
                },