Example #1
0
        private void textTorgTable_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (TorgList.Parse(textTorgTable.Text))
            {
                return;
            }

            e.Cancel           = true;
            textTorgTable.Text = AppVars.Profile.TorgTabl;
            errorTorg.SetError(textTorgTable, "Ошибка в таблице торга");
        }
Example #2
0
        private void ReadTorg(XmlReader xmlReader)
        {
            bool active;

            if (!bool.TryParse(xmlReader[ConstAttibuteTorgActive], out active))
            {
                active = ConstTorgActiveDefault;
            }

            TorgActive = active;

            TorgTabl = xmlReader[ConstAttibuteTorgTabl] ?? ConstTorgTablDefault;
            if (!TorgList.Parse(TorgTabl))
            {
                TorgTabl = ConstTorgTablDefault;
                TorgList.Parse(TorgTabl);
            }

            if (xmlReader[ConstAttibuteTorgMsgAdv] != null)
            {
                TorgMessageAdv = xmlReader[ConstAttibuteTorgMsgAdv];
                TorgList.Parse(TorgMessageAdv);
            }

            int advTime;

            if (!int.TryParse(xmlReader[ConstAttibuteTorgAdvTime], out advTime))
            {
                advTime = AppConsts.TorgAdvTimeDefault;
            }

            if (advTime < AppConsts.TorgAdvTimeMin || advTime > AppConsts.TorgAdvTimeMax)
            {
                advTime = AppConsts.TorgAdvTimeDefault;
            }

            TorgAdvTime = advTime;

            if (xmlReader[ConstAttibuteTorgMsgTooExp] != null)
            {
                TorgMessageTooExp = xmlReader[ConstAttibuteTorgMsgTooExp];
            }

            if (xmlReader[ConstAttibuteTorgMsgThanks] != null)
            {
                TorgMessageThanks = xmlReader[ConstAttibuteTorgMsgThanks];
            }

            if (xmlReader[ConstAttibuteTorgMsgNoMoney] != null)
            {
                TorgMessageNoMoney = xmlReader[ConstAttibuteTorgMsgNoMoney];
            }

            if (xmlReader[ConstAttibuteTorgMsgLess90] != null)
            {
                TorgMessageLess90 = xmlReader[ConstAttibuteTorgMsgLess90];
            }

            bool sliv;

            if (!bool.TryParse(xmlReader[ConstAttibuteTorgSliv], out sliv))
            {
                sliv = ConstTorgSlivDefault;
            }

            TorgSliv = sliv;

            int minlevel;

            if (!int.TryParse(xmlReader[ConstAttibuteTorgMinLevel], out minlevel))
            {
                minlevel = ConstTorgMinLevelDefault;
            }

            TorgMinLevel = minlevel;

            if (xmlReader[ConstAttributeTorgEx] != null)
            {
                TorgEx = xmlReader[ConstAttributeTorgEx];
            }

            if (xmlReader[ConstAttributeTorgDeny] != null)
            {
                TorgDeny = xmlReader[ConstAttributeTorgDeny];
            }
        }
Example #3
0
        private void OnButtonOkClick(object sender, EventArgs e)
        {
            AppVars.Profile.DoAutoDrinkBlaz = checkBoxDoAutoDrinkBlaz.Checked;
            int autoDrinkBlazTied;

            if (!int.TryParse(textBoxAutoDrinkBlazTied.Text, out autoDrinkBlazTied))
            {
                autoDrinkBlazTied = 84;
            }

            AppVars.Profile.AutoDrinkBlazTied = autoDrinkBlazTied;

            AppVars.Profile.DoPromptExit    = checkboxDoPromptExit.Checked;
            AppVars.Profile.DoTray          = checkboxDoTray.Checked;
            AppVars.Profile.ShowTrayBaloons = checkboxShowTrayBaloons.Checked;

            AppVars.Profile.ChatKeepMoving = checkboxDoKeepChatMoving.Checked;
            AppVars.Profile.ChatKeepGame   = checkboxDoKeepChatGame.Checked;
            AppVars.Profile.ChatKeepLog    = checkboxDoKeepChatLog.Checked;
            AppVars.Profile.ChatSizeLog    = (int)linkChatSizeLog.Tag;
            AppVars.Profile.DoChatLevels   = checkDoChatLevels.Checked;

            AppVars.Profile.DoRob = checkDoRob.Checked;

            if (!AppVars.Profile.Stat.Reset && checkStatReset.Checked)
            {
                AppVars.Profile.Stat.LastUpdateDay = DateTime.Now.DayOfYear;
            }

            AppVars.Profile.Stat.Reset = checkStatReset.Checked;

            AppVars.Profile.RazdChatReport = checkboxRazdChatReport.Checked;

            AppVars.Profile.CureNV[0]             = (int)numCureNV1.Value;
            AppVars.Profile.CureNV[1]             = (int)numCureNV2.Value;
            AppVars.Profile.CureNV[2]             = (int)numCureNV3.Value;
            AppVars.Profile.CureNV[3]             = (int)numCureNV4.Value;
            AppVars.Profile.CureAsk[0]            = textCureAsk1.Text;
            AppVars.Profile.CureAsk[1]            = textCureAsk2.Text;
            AppVars.Profile.CureAsk[2]            = textCureAsk3.Text;
            AppVars.Profile.CureAsk[3]            = textCureAsk4.Text;
            AppVars.Profile.CureAdv               = textCureAdv.Text;
            AppVars.Profile.CureAfter             = textCureAfter.Text;
            AppVars.Profile.CureBoi               = textCureBoi.Text;
            AppVars.Profile.CureEnabled[0]        = checkE1.Checked;
            AppVars.Profile.CureEnabled[1]        = checkE2.Checked;
            AppVars.Profile.CureEnabled[2]        = checkE3.Checked;
            AppVars.Profile.CureEnabled[3]        = checkE4.Checked;
            AppVars.Profile.CureDisabledLowLevels = checkD04.Checked;

            AppVars.Profile.MapShowExtend         = checkBoxDoExtendMap.Checked;
            AppVars.Profile.MapBigWidth           = (int)numBigMapWidth.Value;
            AppVars.Profile.MapBigHeight          = (int)numBigMapHeight.Value;
            AppVars.Profile.MapBigScale           = (int)numBigMapScale.Value;
            AppVars.Profile.MapBigTransparency    = (int)numBigMapTransparency.Value;
            AppVars.Profile.MapShowBackColorWhite = checkBoxBigMapBackColorWhite.Checked;
            AppVars.Profile.MapDrawRegion         = checkBoxMapDrawRegion.Checked;

            AppVars.Profile.MapMiniWidth   = (int)numMiniMapWidth.Value;
            AppVars.Profile.MapMiniHeight  = (int)numMiniMapHeight.Value;
            AppVars.Profile.MapMiniScale   = (int)numMiniMapScale.Value;
            AppVars.Profile.MapShowMiniMap = checkShowMiniMap.Checked;

            AppVars.Profile.FishStopOverWeight = checkboxStopOverW.Checked;

            AppVars.Profile.Sound.Enabled       = checkUseSounds.Checked;
            AppVars.Profile.Sound.DoPlayDigits  = checkDoPlayDigits.Checked;
            AppVars.Profile.Sound.DoPlayAttack  = checkDoPlayAttack.Checked;
            AppVars.Profile.Sound.DoPlaySndMsg  = checkDoPlaySndMsg.Checked;
            AppVars.Profile.Sound.DoPlayRefresh = checkDoPlayRefresh.Checked;
            AppVars.Profile.Sound.DoPlayAlarm   = checkDoPlayAlarm.Checked;
            AppVars.Profile.Sound.DoPlayTimer   = checkDoPlayTimer.Checked;

            AppVars.Profile.AutoAdv.Phraz = textPhraz.Text;
            AppVars.Profile.AutoAdv.Sec   = (int)((numAdvMin.Value * 60) + numAdvSec.Value);
            if (AppVars.Profile.AutoAdv.Sec < 30)
            {
                AppVars.Profile.AutoAdv.Sec = 600;
            }

            AppVars.Profile.FishAutoWear = checkFishAutoWear.Checked;
            AppVars.Profile.FishHandOne  = (string)comboFishHand1.SelectedItem;
            AppVars.Profile.FishHandTwo  = (string)comboFishHand2.SelectedItem;

            AppVars.Profile.FishTiedHigh = (int)numFishTiedHigh.Value;
            AppVars.Profile.FishTiedZero = checkFishTiedZero.Checked;

            AppVars.Profile.FishEnabledPrims = 0;
            if (checkPrimBread.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Bread;
            }

            if (checkPrimWorm.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Worm;
            }

            if (checkPrimBigWorm.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.BigWorm;
            }

            if (checkPrimStink.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Stink;
            }

            if (checkPrimFly.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Fly;
            }

            if (checkPrimLight.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Light;
            }

            if (checkPrimDonka.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Donka;
            }

            if (checkPrimMorm.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.Morm;
            }

            if (checkPrimHiFlight.Checked)
            {
                AppVars.Profile.FishEnabledPrims += (int)Prims.HiFlight;
            }

            AppVars.Profile.FishChatReport      = checkboxFishChatReport.Checked;
            AppVars.Profile.FishChatReportColor = checkboxFishChatReportColor.Checked;

            AppVars.Profile.DoAutoAnswer = checkAutoAnswer.Checked;
            AppVars.Profile.AutoAnswer   = textAutoAnswer.Text.Trim().Replace(Environment.NewLine, AppConsts.Br);
            AutoAnswerMachine.SetAnswers(AppVars.Profile.AutoAnswer);

            AppVars.Profile.LightForum = checkLightForum.Checked;

            AppVars.Profile.TorgTabl = textTorgTable.Text;
            TorgList.Parse(textTorgTable.Text);
            AppVars.Profile.TorgMessageAdv = textTorgMessageAdv.Text;

            int advTime;

            if (int.TryParse(textTorgAdvTime.Text, out advTime))
            {
                AppVars.Profile.TorgAdvTime = advTime;
            }

            AppVars.Profile.TorgMessageNoMoney = textTorgMessageNoMoney.Text;
            AppVars.Profile.TorgMessageTooExp  = textTorgMessageTooExp.Text;
            AppVars.Profile.TorgMessageThanks  = textTorgMessageThanks.Text;
            AppVars.Profile.TorgMessageLess90  = textTorgMessageLess90.Text;
            AppVars.Profile.TorgSliv           = checkTorgSliv.Checked;

            int minlevel;

            if (int.TryParse(textTorgMinLevel.Text, out minlevel))
            {
                AppVars.Profile.TorgMinLevel = minlevel;
            }

            AppVars.Profile.TorgEx   = textTorgEx.Text;
            AppVars.Profile.TorgDeny = textTorgDeny.Text;

            AppVars.Profile.DoInvPack     = checkDoInvPack.Checked;
            AppVars.Profile.DoInvPackDolg = checkDoInvPackDolg.Checked;
            AppVars.Profile.DoInvSort     = checkDoInvSort.Checked;

            AppVars.Profile.DoShowFastAttack               = checkDoShowFastAttack.Checked;
            AppVars.Profile.DoShowFastAttackBlood          = checkDoShowFastAttackBlood.Checked;
            AppVars.Profile.DoShowFastAttackUltimate       = checkDoShowFastAttackUltimate.Checked;
            AppVars.Profile.DoShowFastAttackClosedUltimate = checkDoShowFastAttackClosedUltimate.Checked;
            AppVars.Profile.DoShowFastAttackClosed         = checkDoShowFastAttackClosed.Checked;
            AppVars.Profile.DoShowFastAttackFist           = checkDoShowFastAttackFist.Checked;
            AppVars.Profile.DoShowFastAttackClosedFist     = checkDoShowFastAttackClosedFist.Checked;
            AppVars.Profile.DoShowFastAttackOpenNevid      = checkDoShowFastAttackOpenNevid.Checked;
            AppVars.Profile.DoShowFastAttackPoison         = checkDoShowFastAttackPoison.Checked;
            AppVars.Profile.DoShowFastAttackStrong         = checkDoShowFastAttackStrong.Checked;
            AppVars.Profile.DoShowFastAttackNevid          = checkDoShowFastAttackNevid.Checked;
            AppVars.Profile.DoShowFastAttackFog            = checkDoShowFastAttackFog.Checked;
            AppVars.Profile.DoShowFastAttackZas            = checkDoShowFastAttackZas.Checked;
            AppVars.Profile.DoShowFastAttackTotem          = checkDoShowFastAttackTotem.Checked;
            AppVars.Profile.DoShowFastAttackPortal         = checkDoShowFastAttackPortal.Checked;

            AppVars.Profile.ShowOverWarning = checkShowOverWarning.Checked;
            AppVars.Profile.DoStopOnDig     = checkDoStopOnDig.Checked;

            AppVars.Profile.DoAutoCure       = checkDoAutoCure.Checked;
            AppVars.Profile.AutoWearComplect = textAutoWearComplect.Text;

            AppVars.Profile.AutoDrinkBlazOrder = comboBoxDoAutoDrinkBlaz.SelectedIndex;

            if (radioSayNo.Checked)
            {
                AppVars.Profile.BossSay = LezSayType.No;
            }

            if (radioSayChat.Checked)
            {
                AppVars.Profile.BossSay = LezSayType.Chat;
            }

            if (radioSayClan.Checked)
            {
                AppVars.Profile.BossSay = LezSayType.Clan;
            }

            if (radioSayPair.Checked)
            {
                AppVars.Profile.BossSay = LezSayType.Pair;
            }

            AppVars.Profile.Save();
        }