Exemple #1
0
        private void PlayCommonSounds()
        {
            switch (LibraryWeaponShape)
            {
            case 100:
                DXSoundManager.Play(SoundIndex.WandSwing);
                break;

            case 9:
            case 101:
                DXSoundManager.Play(SoundIndex.WoodSwing);
                break;

            case 102:
                DXSoundManager.Play(SoundIndex.AxeSwing);
                break;

            case 103:
                DXSoundManager.Play(SoundIndex.DaggerSwing);
                break;

            case 104:
                DXSoundManager.Play(SoundIndex.ShortSwordSwing);
                break;

            case 26:
            case 105:
                DXSoundManager.Play(SoundIndex.IronSwordSwing);
                break;

            default:
                DXSoundManager.Play(SoundIndex.FistSwing);
                break;
            }
        }
Exemple #2
0
        public DXSound(string fileName, SoundType type)
        {
            FileName  = fileName;
            SoundType = type;

            Volume = DXSoundManager.GetVolume(SoundType);
        }
Exemple #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            foreach (KeyValuePair <LibraryFile, string> pair in Libraries.LibraryList)
            {
                if (!File.Exists(@".\" + pair.Value))
                {
                    continue;
                }

                CEnvir.LibraryList[pair.Key] = new MirLibrary(@".\" + pair.Value);
            }


            ConfigReader.Load();

            CEnvir.LoadDatabase();

            CEnvir.Target = new TargetForm();
            DXManager.Create();
            DXSoundManager.Create();

            DXControl.ActiveScene = new LoginScene(Config.IntroSceneSize);

            MessagePump.Run(CEnvir.Target, CEnvir.GameLoop);

            ConfigReader.Save();

            CEnvir.Session?.Save(true);
            CEnvir.Unload();
            DXManager.Unload();
            DXSoundManager.Unload();
        }
Exemple #4
0
        public static void ReturnToLogin()
        {
            if (DXControl.ActiveScene is LoginScene)
            {
                return;                                      // handle ?
            }
            DXControl.ActiveScene.Dispose();
            DXSoundManager.StopAllSounds();
            DXControl.ActiveScene = new LoginScene(Config.IntroSceneSize);

            BlockList = new List <ClientBlockInfo>();
        }
Exemple #5
0
        public override void FrameIndexChanged()
        {
            base.FrameIndexChanged();

            switch (CurrentAction)
            {
            case MirAction.Moving:
                switch (CurrentAnimation)
                {
                case MirAnimation.HorseWalking:
                    if (FrameIndex == 1)
                    {
                        DXSoundManager.Play(SoundIndex.HorseWalk1);
                    }
                    if (FrameIndex == 4)
                    {
                        DXSoundManager.Play(SoundIndex.HorseWalk2);
                    }
                    break;

                case MirAnimation.HorseRunning:
                    if (FrameIndex != 1)
                    {
                        return;
                    }
                    DXSoundManager.Play(SoundIndex.HorseRun);
                    break;

                default:
                    if (FrameIndex != 1 && FrameIndex != 4)
                    {
                        return;
                    }
                    DXSoundManager.Play((SoundIndex)((int)SoundIndex.Foot1 + CEnvir.Random.Next((int)SoundIndex.Foot4 - (int)SoundIndex.Foot1) + 1));
                    break;
                }
                break;

            case MirAction.Spell:
                switch (MagicType)
                {
                case MagicType.SeismicSlam:
                    if (FrameIndex == 4)
                    {
                        ShakeScreenCount = 10F;
                    }
                    break;
                }
                break;
            }
        }
 public override void OnRemoved()
 {
     switch (Effect)
     {
     case SpellEffect.SwordOfVengeance:
         new MirEffect(1100, 10, TimeSpan.FromMilliseconds(100), LibraryFile.MagicEx6, 10, 35, Globals.FireColour)
         {
             Blend     = true,
             MapTarget = CurrentLocation,
         };
         DXSoundManager.Play(SoundIndex.FireStormEnd);
         break;
     }
 }
Exemple #7
0
 private void PlayAssassinSounds()
 {
     if (LibraryWeaponShape >= 1200)
     {
         DXSoundManager.Play(SoundIndex.ClawAttack);
     }
     else if (LibraryWeaponShape >= 1100)
     {
         DXSoundManager.Play(SoundIndex.GlaiveAttack);
     }
     else
     {
         PlayCommonSounds(); //?
     }
 }
Exemple #8
0
        public void SetVolume()
        {
            Volume = DXSoundManager.GetVolume(SoundType);

            for (int i = BufferList.Count - 1; i >= 0; i--)
            {
                if (BufferList[i].Disposed)
                {
                    BufferList.RemoveAt(i);
                    continue;
                }

                BufferList[i].Volume = Volume;
            }
        }
Exemple #9
0
        public override void SetAction(ObjectAction action)
        {
            base.SetAction(action);

            switch (CurrentAction)
            {
            case MirAction.Attack:
                switch (MagicType)
                {
                    #region Sweet Brier and Karma (Karma should have different attack will do later if can be bothered)
                case MagicType.SweetBrier:
                case MagicType.Karma:
                    if (LibraryWeaponShape >= 1200)
                    {
                        Effects.Add(new MirEffect(300, 6, TimeSpan.FromMilliseconds(100), LibraryFile.MagicEx4, 20, 70, Globals.NoneColour)         //Element style?
                        {
                            Blend      = true,
                            Target     = this,
                            DrawColour = Globals.NoneColour,
                            Direction  = Direction,
                        });
                    }
                    else if (LibraryWeaponShape >= 1100)
                    {
                        Effects.Add(new MirEffect(100, 6, TimeSpan.FromMilliseconds(100), LibraryFile.MagicEx4, 20, 70, Globals.NoneColour)         //Element style?
                        {
                            Blend      = true,
                            Target     = this,
                            DrawColour = Globals.NoneColour,
                            Direction  = Direction,
                        });
                    }

                    if (Gender == MirGender.Male)
                    {
                        DXSoundManager.Play(SoundIndex.SweetBrierMale);
                    }
                    else
                    {
                        DXSoundManager.Play(SoundIndex.SweetBrierFemale);
                    }
                    break;
                    #endregion
                }
                break;
            }
        }
        private void SaveSettings(object o, MouseEventArgs e)
        {
            if (Config.FullScreen != FullScreenCheckBox.Checked)
            {
                DXManager.ToggleFullScreen();
            }

            if (GameSizeComboBox.SelectedItem is Size && Config.GameSize != (Size)GameSizeComboBox.SelectedItem)
            {
                Config.GameSize = (Size)GameSizeComboBox.SelectedItem;

                if (ActiveScene is GameScene)
                {
                    ActiveScene.Size = Config.GameSize;
                    DXManager.SetResolution(ActiveScene.Size);
                }
            }

            if (LanguageComboBox.SelectedItem is string && Config.Language != (string)LanguageComboBox.SelectedItem)
            {
                Config.Language = (string)LanguageComboBox.SelectedItem;

                if (CEnvir.Connection != null && CEnvir.Connection.ServerConnected)
                {
                    CEnvir.Enqueue(new C.SelectLanguage {
                        Language = Config.Language
                    });
                }
            }


            if (Config.VSync != VSyncCheckBox.Checked)
            {
                Config.VSync = VSyncCheckBox.Checked;
                DXManager.ResetDevice();
            }

            Config.LimitFPS   = LimitFPSCheckBox.Checked;
            Config.ClipMouse  = ClipMouseCheckBox.Checked;
            Config.DebugLabel = DebugLabelCheckBox.Checked;

            DebugLabel.IsVisible = Config.DebugLabel;
            PingLabel.IsVisible  = Config.DebugLabel;

            if (Config.SoundInBackground != BackgroundSoundBox.Checked)
            {
                Config.SoundInBackground = BackgroundSoundBox.Checked;

                DXSoundManager.UpdateFlags();
            }


            bool volumeChanged = false;


            if (Config.SystemVolume != SystemVolumeBox.Value)
            {
                Config.SystemVolume = (int)SystemVolumeBox.Value;
                volumeChanged       = true;
            }


            if (Config.MusicVolume != MusicVolumeBox.Value)
            {
                Config.MusicVolume = (int)MusicVolumeBox.Value;
                volumeChanged      = true;
            }


            if (Config.PlayerVolume != PlayerVolumeBox.Value)
            {
                Config.PlayerVolume = (int)PlayerVolumeBox.Value;
                volumeChanged       = true;
            }

            if (Config.MonsterVolume != MonsterVolumeBox.Value)
            {
                Config.MonsterVolume = (int)MonsterVolumeBox.Value;
                volumeChanged        = true;
            }

            if (Config.MagicVolume != SpellVolumeBox.Value)
            {
                Config.MagicVolume = (int)SpellVolumeBox.Value;
                volumeChanged      = true;
            }

            Config.ShowItemNames     = ItemNameCheckBox.Checked;
            Config.ShowMonsterNames  = MonsterNameCheckBox.Checked;
            Config.ShowPlayerNames   = PlayerNameCheckBox.Checked;
            Config.ShowUserHealth    = UserHealthCheckBox.Checked;
            Config.ShowMonsterHealth = MonsterHealthCheckBox.Checked;
            Config.ShowDamageNumbers = DamageNumbersCheckBox.Checked;

            Config.EscapeCloseAll     = EscapeCloseAllCheckBox.Checked;
            Config.ShiftOpenChat      = ShiftOpenChatCheckBox.Checked;
            Config.RightClickDeTarget = RightClickDeTargetCheckBox.Checked;
            Config.MonsterBoxVisible  = MonsterBoxVisibleCheckBox.Checked;
            Config.LogChat            = LogChatCheckBox.Checked;
            Config.DrawEffects        = DrawEffectsCheckBox.Checked;

            if (volumeChanged)
            {
                DXSoundManager.AdjustVolume();
            }

            Config.UseNetworkConfig = UseNetworkConfigCheckBox.Checked;
            Config.IPAddress        = IPAddressTextBox.TextBox.Text;
            Config.Port             = (int)PortBox.Value;


            bool coloursChanged = false;

            if (Config.LocalTextColour != LocalColourBox.BackColour)
            {
                Config.LocalTextColour = LocalColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.GMWhisperInTextColour != GMWhisperInColourBox.BackColour)
            {
                Config.GMWhisperInTextColour = GMWhisperInColourBox.BackColour;
                coloursChanged = true;
            }

            if (Config.WhisperInTextColour != WhisperInColourBox.BackColour)
            {
                Config.WhisperInTextColour = WhisperInColourBox.BackColour;
                coloursChanged             = true;
            }

            if (Config.WhisperOutTextColour != WhisperOutColourBox.BackColour)
            {
                Config.WhisperOutTextColour = WhisperOutColourBox.BackColour;
                coloursChanged = true;
            }

            if (Config.GroupTextColour != GroupColourBox.BackColour)
            {
                Config.GroupTextColour = GroupColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.GuildTextColour != GuildColourBox.BackColour)
            {
                Config.GuildTextColour = GuildColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.ShoutTextColour != ShoutColourBox.BackColour)
            {
                Config.ShoutTextColour = ShoutColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.GlobalTextColour != GlobalColourBox.BackColour)
            {
                Config.GlobalTextColour = GlobalColourBox.BackColour;
                coloursChanged          = true;
            }

            if (Config.ObserverTextColour != ObserverColourBox.BackColour)
            {
                Config.ObserverTextColour = ObserverColourBox.BackColour;
                coloursChanged            = true;
            }

            if (Config.HintTextColour != HintColourBox.BackColour)
            {
                Config.HintTextColour = HintColourBox.BackColour;
                coloursChanged        = true;
            }

            if (Config.SystemTextColour != SystemColourBox.BackColour)
            {
                Config.SystemTextColour = SystemColourBox.BackColour;
                coloursChanged          = true;
            }

            if (Config.GainsTextColour != GainsColourBox.BackColour)
            {
                Config.GainsTextColour = GainsColourBox.BackColour;
                coloursChanged         = true;
            }
            if (Config.AnnouncementTextColour != AnnouncementColourBox.BackColour)
            {
                Config.AnnouncementTextColour = AnnouncementColourBox.BackColour;
                coloursChanged = true;
            }

            if (coloursChanged && GameScene.Game != null)
            {
                foreach (ChatTab tab in ChatTab.Tabs)
                {
                    tab.UpdateColours();
                }
            }
        }
Exemple #11
0
 public override void PlayDieSound()
 {
     DXSoundManager.Play(Gender == MirGender.Male ? SoundIndex.MaleDie : SoundIndex.FemaleDie);
 }
Exemple #12
0
 public override void PlayStruckSound()
 {
     DXSoundManager.Play(Gender == MirGender.Male ? SoundIndex.MaleStruck : SoundIndex.FemaleStruck);
     DXSoundManager.Play(SoundIndex.GenericStruckPlayer);
 }
Exemple #13
0
        public void UpdateLibraries()
        {
            Frames = new Dictionary <MirAnimation, Frame>();
            switch (Effect)
            {
            case SpellEffect.SafeZone:
                CEnvir.LibraryList.TryGetValue(LibraryFile.Magic, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(649, 1, 0, TimeSpan.FromDays(365));
                Blended   = true;
                BlendRate = 0.3f;
                break;

            case SpellEffect.FireWall:
            case SpellEffect.MonsterFireWall:
                CEnvir.LibraryList.TryGetValue(LibraryFile.Magic, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(920, 3, 0, TimeSpan.FromMilliseconds(150));
                Blended     = true;
                LightColour = Color.LightSalmon;
                BlendRate   = 0.55f;
                Light       = 15;
                break;

            case SpellEffect.Tempest:
                CEnvir.LibraryList.TryGetValue(LibraryFile.MagicEx2, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(920, 10, 0, TimeSpan.FromMilliseconds(150));
                Blended     = true;
                LightColour = Globals.WindColour;
                BlendRate   = 0.55f;
                Light       = 15;
                break;

            case SpellEffect.TrapOctagon:
                CEnvir.LibraryList.TryGetValue(LibraryFile.Magic, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(640, 10, 0, TimeSpan.FromMilliseconds(100));
                Blended   = true;
                BlendRate = 0.8f;
                break;

            case SpellEffect.PoisonousCloud:
                CEnvir.LibraryList.TryGetValue(LibraryFile.MagicEx4, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(400, 15, 0, TimeSpan.FromMilliseconds(100));
                DefaultColour = Color.SaddleBrown;
                Blended       = true;
                Light         = 0;
                DXSoundManager.Play(SoundIndex.PoisonousCloudStart);
                break;

            case SpellEffect.DarkSoulPrison:
                CEnvir.LibraryList.TryGetValue(LibraryFile.MagicEx6, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(700, 10, 0, TimeSpan.FromMilliseconds(100));
                Blended = true;
                Light   = 0;
                DXSoundManager.Play(SoundIndex.DarkSoulPrison);
                break;

            case SpellEffect.SwordOfVengeance:
                CEnvir.LibraryList.TryGetValue(LibraryFile.MagicEx6, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(1000, 8, 0, TimeSpan.FromMilliseconds(100));
                Frames[MirAnimation.Die]      = new Frame(1100, 10, 0, TimeSpan.FromMilliseconds(100));
                Blended = true;
                Light   = 0;
                //DXSoundManager.Play(SoundIndex.DarkSoulPrison);
                break;

            case SpellEffect.MonsterDeathCloud:
                CEnvir.LibraryList.TryGetValue(LibraryFile.MonMagicEx2, out BodyLibrary);
                Frames[MirAnimation.Standing] = new Frame(850, 10, 0, TimeSpan.FromMilliseconds(100));
                Blended   = true;
                Light     = 0;
                BlendRate = 1F;
                DXSoundManager.Play(SoundIndex.JinchonDevilAttack3);
                break;

            case SpellEffect.Rubble:
                CEnvir.LibraryList.TryGetValue(LibraryFile.ProgUse, out BodyLibrary);
                int index;

                if (Power > 20)
                {
                    index = 234;
                }
                else if (Power > 15)
                {
                    index = 233;
                }
                else if (Power > 10)
                {
                    index = 232;
                }
                else if (Power > 5)
                {
                    index = 231;
                }
                else
                {
                    index = 230;
                }

                Frames[MirAnimation.Standing] = new Frame(index, 1, 0, TimeSpan.FromMilliseconds(100));

                Light = 0;
                break;
            }
        }