Exemplo n.º 1
0
        /// <summary>
        /// This timer handles the scrolling credits.
        /// </summary>
        public void TmrCredits_Tick(object sender, EventArgs e)
        {
            string credits  = "";
            string filepath = "";

            filepath = Application.StartupPath + "\\Data\\credits.txt";
            lblScrollingCredits.Top = 177;
            if (C_UpdateUI.PnlCreditsVisible == true)
            {
                tmrCredits.Enabled = false;
                string refString = "";
                credits = C_DataBase.GetFileContents(filepath, ref refString);
                lblScrollingCredits.Text = "" + Microsoft.VisualBasic.Constants.vbNewLine + credits;
                while (!(C_UpdateUI.PnlCreditsVisible == false))
                {
                    lblScrollingCredits.Top--;
                    if (lblScrollingCredits.Bottom <= lblCreditsTop.Bottom)
                    {
                        lblScrollingCredits.Top = 177;
                    }
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(100);
                }
            }
        }
Exemplo n.º 2
0
        public void btnSaveSettings_Click(object sender, EventArgs e)
        {
            //music
            if (optMOn.Checked == true)
            {
                C_Types.Options.Music = (byte)1;
                // start music playing
                C_Sound.PlayMusic(C_Maps.Map.Music.Trim());
            }
            else
            {
                C_Types.Options.Music = (byte)0;
                // stop music playing
                C_Sound.StopMusic();
                C_Sound.CurMusic = "";
            }

            //sound
            if (optSOn.Checked == true)
            {
                C_Types.Options.Sound = (byte)1;
            }
            else
            {
                C_Types.Options.Sound = (byte)0;
                C_Sound.StopSound();
            }

            //screensize
            C_Types.Options.ScreenSize = System.Convert.ToByte(cmbScreenSize.SelectedIndex);

            if (chkHighEnd.Checked)
            {
                C_Types.Options.HighEnd = (byte)1;
            }
            else
            {
                C_Types.Options.HighEnd = (byte)0;
            }

            if (chkNpcBars.Checked)
            {
                C_Types.Options.ShowNpcBar = (byte)1;
            }
            else
            {
                C_Types.Options.ShowNpcBar = (byte)0;
            }

            // save to config.ini
            C_DataBase.SaveOptions();

            //reload options
            C_DataBase.LoadOptions();

            C_General.RePositionGui();

            this.Visible = false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles SaveIP button press.
        /// </summary>
        public void BtnSaveIP_Click(object sender, EventArgs e)
        {
            C_Types.Options.Ip   = System.Convert.ToString(txtIP.Text);
            C_Types.Options.Port = System.Convert.ToInt32(txtPort.Text);

            pnlIPConfig.Visible = false;
            C_DataBase.SaveOptions();
        }
Exemplo n.º 4
0
        public static void Packet_CheckMap(ref byte[] data)
        {
            int        x;
            int        y;
            int        i       = 0;
            byte       needMap = 0;
            ByteStream buffer  = new ByteStream(data);

            C_Variables.GettingMap = true;

            // Erase all players except self
            for (i = 1; i <= C_Variables.TotalOnline; i++)             //MAX_PLAYERS
            {
                if (i != C_Variables.Myindex)
                {
                    C_Player.SetPlayerMap(i, 0);
                }
            }

            // Erase all temporary tile values
            C_GameLogic.ClearTempTile();
            ClearMapNpcs();
            ClearMapItems();
            C_DataBase.ClearBlood();
            ClearMap();

            // Get map num
            x = buffer.ReadInt32();
            // Get revision
            y = buffer.ReadInt32();

            needMap = (byte)1;

            // Either the revisions didn't match or we dont have the map, so we need it
            buffer = new ByteStream(4);
            buffer.WriteInt32((System.Int32)Packets.ClientPackets.CNeedMap);
            buffer.WriteInt32(needMap);
            C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);

            buffer.Dispose();
        }
Exemplo n.º 5
0
        public static void Startup()
        {
            SFML.Portable.Activate();

            SetStatus(Strings.Get("loadscreen", "loading"));

            FrmMenu.Default.Visible = true;

            Application.DoEvents();

            C_Types.CharSelection = new C_Types.CharSelRec[4];

            C_Types.Player = new C_Types.PlayerRec[Constants.MAX_PLAYERS + 1];

            for (var i = 1; i <= Constants.MAX_PLAYERS; i++)
            {
                C_Player.ClearPlayer(i);
            }

            C_AutoTiles.ClearAutotiles();

            //Housing
            C_Housing.House       = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];
            C_Housing.HouseConfig = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];

            //quests
            C_Quest.ClearQuests();

            //npc's
            C_DataBase.ClearNpcs();
            C_Maps.Map.Npc = new int[Constants.MAX_MAP_NPCS + 1];
            C_Maps.MapNpc  = new C_Types.MapNpcRec[Constants.MAX_MAP_NPCS + 1];
            for (var i = 0; i <= Constants.MAX_MAP_NPCS; i++)
            {
                for (var x = 0; x <= (int)Enums.VitalType.Count - 1; x++)
                {
                    C_Maps.MapNpc[(int)i].Vital = new int[(int)x + 1];
                }
            }

            C_Shops.ClearShops();

            C_DataBase.ClearAnimations();

            C_DataBase.ClearAnimInstances();

            C_Banks.ClearBank();

            C_Projectiles.MapProjectiles = new C_Projectiles.MapProjectileRec[C_Projectiles.MaxProjectiles + 1];
            C_Projectiles.Projectiles    = new C_Projectiles.ProjectileRec[C_Projectiles.MaxProjectiles + 1];

            C_Items.ClearItems();

            //craft
            C_Crafting.ClearRecipes();

            //party
            C_Parties.ClearParty();

            //pets
            C_Pets.ClearPets();

            C_Variables.GettingMap = true;
            C_Variables.VbQuote    = System.Convert.ToString((char)34);           // "

            // Update the form with the game's name before it's loaded
            FrmGame.Default.Text = C_Constants.GameName;

            SetStatus(Strings.Get("loadscreen", "options"));

            // load options
            if (File.Exists(Application.StartupPath + "\\Data\\Config.xml"))
            {
                C_DataBase.LoadOptions();
            }
            else
            {
                C_DataBase.CreateOptions();
            }

            // randomize rnd's seed
            VBMath.Randomize();

            SetStatus(Strings.Get("loadscreen", "network"));

            FrmMenu.Default.Text = C_Constants.GameName;

            // DX7 Master Object is already created, early binding
            SetStatus(Strings.Get("loadscreen", "graphics"));
            C_Maps.CheckTilesets();
            C_DataBase.CheckCharacters();
            C_DataBase.CheckPaperdolls();
            C_DataBase.CheckAnimations();
            C_Items.CheckItems();
            C_Resources.CheckResources();
            C_DataBase.CheckSkillIcons();
            C_DataBase.CheckFaces();
            C_DataBase.CheckFog();
            C_DataBase.CacheMusic();
            C_DataBase.CacheSound();
            C_DataBase.CheckEmotes();
            C_DataBase.CheckPanoramas();
            C_Housing.CheckFurniture();
            C_Projectiles.CheckProjectiles();
            C_DataBase.CheckParallax();

            C_Graphics.InitGraphics();

            // check if we have main-menu music
            if (C_Types.Options.Music == 1 && C_Types.Options.MenuMusic.Trim().Length > 0)
            {
                C_Sound.PlayMusic(C_Types.Options.MenuMusic.Trim());
                C_Sound.MusicPlayer.Volume = 100;
            }

            // Reset values
            C_Variables.Ping = -1;

            // set values for directional blocking arrows
            C_Variables.DirArrowX[1] = 12;             // up
            C_Variables.DirArrowY[1] = 0;

            C_Variables.DirArrowX[2] = 12;             // down
            C_Variables.DirArrowY[2] = 23;

            C_Variables.DirArrowX[3] = 0;             // left
            C_Variables.DirArrowY[3] = 12;

            C_Variables.DirArrowX[4] = 23;             // right
            C_Variables.DirArrowY[4] = 12;

            //set gui switches
            C_UpdateUI.HudVisible = true;

            SetStatus(Strings.Get("loadscreen", "starting"));
            Started = true;
            C_UpdateUI.Frmmenuvisible = true;
            C_UpdateUI.Pnlloadvisible = false;

            //C_UpdateUI.PnlInventoryVisible = true;

            C_NetworkConfig.InitNetwork();

            C_GameLogic.GameLoop();
        }