Example #1
0
        public List <Portal> GetMinilandPortals(long characterId)
        {
            var nosville    = _mapInstanceProvider.GetBaseMapById(1);
            var oldNosville = _mapInstanceProvider.GetBaseMapById(145);
            var miniland    = _mapInstanceProvider.GetMapInstance(_minilandIds[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
                },
                new Portal
                {
                    SourceX = 9,
                    SourceY = 171,
                    DestinationX = 5,
                    DestinationY = 8,
                    Type = PortalType.Miniland,
                    SourceMapId = 145,
                    DestinationMapId = 20001,
                    DestinationMapInstanceId = miniland.MapInstanceId,
                    SourceMapInstanceId = oldNosville.MapInstanceId
                }
            });
        }
Example #2
0
        public override void Execute(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)
                {
                    _logger.Error(Language.Instance.GetMessageFromKey(LanguageKey.USER_NOT_CONNECTED,
                                                                      session.Account.Language));
                    return;
                }

                session.ChangeMapInstance(targetSession.MapInstanceId, targetSession.MapX, targetSession.MapY);
                return;
            }

            var mapInstance = _mapInstanceProvider.GetBaseMapById(mapId);

            if (mapInstance == null)
            {
                _logger.Error(
                    Language.Instance.GetMessageFromKey(LanguageKey.MAP_DONT_EXIST, session.Account.Language));
                return;
            }

            session.ChangeMap(mapId, teleportPacket.MapX, teleportPacket.MapY);
        }