Ejemplo n.º 1
0
        public void SendCurrentTextures()
        {
            BlockID side = ConvertBlock(level.Config.EdgeBlock);
            BlockID edge = ConvertBlock(level.Config.HorizonBlock);

            string url = GetTextureUrl();

            if (Supports(CpeExt.EnvMapAspect))
            {
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.EnvMapUrl("", hasCP437));
                }
                Send(Packet.EnvMapUrl(url, hasCP437));
            }
            else if (Supports(CpeExt.EnvMapAppearance, 2))
            {
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.MapAppearanceV2("", (byte)side, (byte)edge, level.Config.EdgeLevel,
                                                level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
                }
                Send(Packet.MapAppearanceV2(url, (byte)side, (byte)edge, level.Config.EdgeLevel,
                                            level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
                lastUrl = url;
            }
            else if (Supports(CpeExt.EnvMapAppearance))
            {
                url = level.Config.Terrain.Length == 0 ? ServerConfig.DefaultTerrain : level.Config.Terrain;
                Send(Packet.MapAppearance(url, (byte)side, (byte)edge, level.Config.EdgeLevel, hasCP437));
            }
        }
Ejemplo n.º 2
0
        public void SendCurrentMapAppearance()
        {
            byte side = (byte)level.Config.EdgeBlock, edge = (byte)level.Config.HorizonBlock;

            if (!hasBlockDefs)
            {
                side = level.RawFallback(side);
            }
            if (!hasBlockDefs)
            {
                edge = level.RawFallback(edge);
            }

            if (Supports(CpeExt.EnvMapAspect))
            {
                string url = GetTextureUrl();
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.EnvMapUrl("", hasCP437));
                }
                Send(Packet.EnvMapUrl(url, hasCP437));

                Send(Packet.EnvMapProperty(EnvProp.SidesBlock, side));
                Send(Packet.EnvMapProperty(EnvProp.EdgeBlock, edge));
                Send(Packet.EnvMapProperty(EnvProp.EdgeLevel, level.Config.EdgeLevel));
                Send(Packet.EnvMapProperty(EnvProp.SidesOffset, level.Config.SidesOffset));
                Send(Packet.EnvMapProperty(EnvProp.CloudsLevel, level.Config.CloudsHeight));

                Send(Packet.EnvMapProperty(EnvProp.MaxFog, level.Config.MaxFogDistance));
                Send(Packet.EnvMapProperty(EnvProp.CloudsSpeed, level.Config.CloudsSpeed));
                Send(Packet.EnvMapProperty(EnvProp.WeatherSpeed, level.Config.WeatherSpeed));
                Send(Packet.EnvMapProperty(EnvProp.WeatherFade, level.Config.WeatherFade));
                Send(Packet.EnvMapProperty(EnvProp.ExpFog, level.Config.ExpFog ? 1 : 0));
                Send(Packet.EnvMapProperty(EnvProp.SkyboxHorSpeed, level.Config.SkyboxHorSpeed));
                Send(Packet.EnvMapProperty(EnvProp.SkyboxVerSpeed, level.Config.SkyboxVerSpeed));
            }
            else if (Supports(CpeExt.EnvMapAppearance, 2))
            {
                string url = GetTextureUrl();
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.MapAppearanceV2("", side, edge, level.Config.EdgeLevel,
                                                level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
                }
                Send(Packet.MapAppearanceV2(url, side, edge, level.Config.EdgeLevel,
                                            level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
                lastUrl = url;
            }
            else if (Supports(CpeExt.EnvMapAppearance))
            {
                string url = level.Config.Terrain.Length == 0 ? ServerConfig.DefaultTerrain : level.Config.Terrain;
                Send(Packet.MapAppearance(url, side, edge, level.Config.EdgeLevel, hasCP437));
            }
        }
Ejemplo n.º 3
0
        public void SendCurrentMapAppearance()
        {
            byte side = (byte)level.EdgeBlock, edge = (byte)level.HorizonBlock;

            if (side >= Block.CpeCount && !hasBlockDefs)
            {
                side = level.GetFallback(side);
            }
            if (edge >= Block.CpeCount && !hasBlockDefs)
            {
                edge = level.GetFallback(edge);
            }

            if (HasCpeExt(CpeExt.EnvMapAspect))
            {
                string url = GetTextureUrl();
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.EnvMapUrl(""));
                }
                Send(Packet.EnvMapUrl(url));

                Send(Packet.EnvMapProperty(EnvProp.SidesBlock, side));
                Send(Packet.EnvMapProperty(EnvProp.EdgeBlock, edge));
                Send(Packet.EnvMapProperty(EnvProp.EdgeLevel, level.EdgeLevel));
                Send(Packet.EnvMapProperty(EnvProp.CloudsLevel, level.CloudsHeight));
                Send(Packet.EnvMapProperty(EnvProp.MaxFog, level.MaxFogDistance));
                Send(Packet.EnvMapProperty(EnvProp.CloudsSpeed, level.CloudsSpeed));
                Send(Packet.EnvMapProperty(EnvProp.WeatherSpeed, level.WeatherSpeed));
            }
            else if (HasCpeExt(CpeExt.EnvMapAppearance, 2))
            {
                string url = GetTextureUrl();
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.MapAppearanceV2("", side, edge, level.EdgeLevel, level.CloudsHeight, level.MaxFogDistance));
                }
                Send(Packet.MapAppearanceV2(url, side, edge, level.EdgeLevel, level.CloudsHeight, level.MaxFogDistance));
                lastUrl = url;
            }
            else if (HasCpeExt(CpeExt.EnvMapAppearance))
            {
                string url = level.terrainUrl == "" ? Server.defaultTerrainUrl : level.terrainUrl;
                Send(Packet.MapAppearance(url, side, edge, level.EdgeLevel));
            }
        }
Ejemplo n.º 4
0
        public void SendCurrentTextures()
        {
            Zone zone         = ZoneIn;
            int  cloudsHeight = CurrentEnvProp(EnvProp.CloudsLevel, zone);
            int  edgeHeight   = CurrentEnvProp(EnvProp.EdgeLevel, zone);
            int  maxFogDist   = CurrentEnvProp(EnvProp.MaxFog, zone);

            int  sideRaw = CurrentEnvProp(EnvProp.SidesBlock, zone);
            int  edgeRaw = CurrentEnvProp(EnvProp.EdgeBlock, zone);
            byte side    = (byte)ConvertBlock((BlockID)sideRaw);
            byte edge    = (byte)ConvertBlock((BlockID)edgeRaw);

            string url = GetTextureUrl();

            if (Supports(CpeExt.EnvMapAspect))
            {
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.EnvMapUrl("", hasCP437));
                }
                Send(Packet.EnvMapUrl(url, hasCP437));
            }
            else if (Supports(CpeExt.EnvMapAppearance, 2))
            {
                // reset all other textures back to client default.
                if (url != lastUrl)
                {
                    Send(Packet.MapAppearanceV2("", side, edge, edgeHeight, cloudsHeight, maxFogDist, hasCP437));
                }
                Send(Packet.MapAppearanceV2(url, side, edge, edgeHeight, cloudsHeight, maxFogDist, hasCP437));
                lastUrl = url;
            }
            else if (Supports(CpeExt.EnvMapAppearance))
            {
                url = level.Config.Terrain.Length == 0 ? Server.Config.DefaultTerrain : level.Config.Terrain;
                Send(Packet.MapAppearance(url, side, edge, edgeHeight, hasCP437));
            }
        }