Exemplo n.º 1
0
        public void LblCurrencyOk_Click(object sender, EventArgs e)
        {
            if (Information.IsNumeric(txtCurrency.Text))
            {
                if (C_Variables.CurrencyMenu == ((byte)1))                  // drop item
                {
                    C_NetworkSend.SendDropItem(C_Variables.TmpCurrencyItem, System.Convert.ToInt32(Conversion.Val(txtCurrency.Text)));
                }                 // deposit item
                else if (C_Variables.CurrencyMenu == ((byte)2))
                {
                    C_Banks.DepositItem(C_Variables.TmpCurrencyItem, System.Convert.ToInt32(Conversion.Val(txtCurrency.Text)));
                }                 // withdraw item
                else if (C_Variables.CurrencyMenu == ((byte)3))
                {
                    C_Banks.WithdrawItem(C_Variables.TmpCurrencyItem, System.Convert.ToInt32(Conversion.Val(txtCurrency.Text)));
                }                 // trade item
                else if (C_Variables.CurrencyMenu == ((byte)4))
                {
                    C_Trade.TradeItem(C_Variables.TmpCurrencyItem, System.Convert.ToInt32(Conversion.Val(txtCurrency.Text)));
                }
            }

            pnlCurrency.Visible         = false;
            C_Variables.TmpCurrencyItem = 0;
            txtCurrency.Text            = "";
            C_Variables.CurrencyMenu    = (byte)0;           // clear
        }
Exemplo n.º 2
0
        public static void UpdateUi()
        {
            if (ReloadFrmMain == true)
            {
                ReloadFrmMain = false;
            }

            if (C_Variables.UpdateNews == true)
            {
                FrmMenu.Default.lblNews.Text = C_Variables.News;
                FrmMenu.Default.Text         = C_Constants.GameName;
                FrmGame.Default.Text         = C_Constants.GameName;
                C_Variables.UpdateNews       = false;
            }

            if (PnlRegisterVisible != FrmMenu.Default.pnlRegister.Visible)
            {
                FrmMenu.Default.pnlRegister.Visible = PnlRegisterVisible;
                FrmMenu.Default.pnlRegister.BringToFront();
            }

            if (DrawChar == true)
            {
                FrmMenu.Default.DrawCharacter();
                DrawChar = false;
            }

            if (PnlCharCreateVisible != FrmMenu.Default.pnlNewChar.Visible)
            {
                FrmMenu.Default.pnlNewChar.Visible = PnlCharCreateVisible;
                FrmMenu.Default.pnlNewChar.BringToFront();
                DrawChar = true;
            }

            if (Lblnextcharleft != FrmMenu.Default.lblNextChar.Left)
            {
                FrmMenu.Default.lblNextChar.Left = Lblnextcharleft;
            }

            if (!ReferenceEquals(Cmbclass, null))
            {
                FrmMenu.Default.cmbClass.Items.Clear();

                for (var i = 1; i <= (Cmbclass.Length - 1); i++)
                {
                    FrmMenu.Default.cmbClass.Items.Add(Cmbclass[(int)i]);
                }

                FrmMenu.Default.cmbClass.SelectedIndex = 0;

                FrmMenu.Default.rdoMale.Checked = true;

                FrmMenu.Default.txtCharName.Focus();

                Cmbclass = null;
            }

            if (PnlLoginVisible != FrmMenu.Default.pnlLogin.Visible)
            {
                FrmMenu.Default.pnlLogin.Visible = PnlLoginVisible;
                if (PnlLoginVisible)
                {
                    FrmMenu.Default.txtLogin.Focus();
                }
            }

            if (PnlCreditsVisible != FrmMenu.Default.pnlCredits.Visible)
            {
                FrmMenu.Default.pnlCredits.Visible = PnlCreditsVisible;
            }

            if (Frmmenuvisible != FrmMenu.Default.Visible)
            {
                FrmMenu.Default.Visible = Frmmenuvisible;
            }

            if (DrawCharSelect)
            {
                FrmMenu.Default.DrawCharacterSelect();
                DrawCharSelect = false;
            }

            if (PnlCharSelectVisible != FrmMenu.Default.pnlCharSelect.Visible)
            {
                FrmMenu.Default.pnlCharSelect.Visible = PnlCharSelectVisible;
                if (PnlCharSelectVisible)
                {
                    DrawCharSelect = true;
                }
            }

            if (Frmmaingamevisible != FrmGame.Default.Visible)
            {
                FrmGame.Default.Visible = Frmmaingamevisible;
            }

            if (C_Crafting.InitCrafting == true)
            {
                C_Crafting.CraftingInit();
                C_Crafting.InitCrafting = false;
            }

            if (NeedToOpenShop == true)
            {
                C_GameLogic.OpenShop(NeedToOpenShopNum);
                NeedToOpenShop    = false;
                NeedToOpenShopNum = 0;
                PnlShopVisible    = true;
            }

            if (NeedToOpenBank == true)
            {
                C_Banks.InBank = System.Convert.ToInt32(true);
                PnlBankVisible = true;
                C_Banks.DrawBank();
                NeedToOpenBank = false;
            }

            if (NeedToOpenTrade == true)
            {
                C_Trade.InTrade = true;
                PnlTradeVisible = true;

                NeedToOpenTrade = false;
            }

            if (NeedtoCloseTrade == true)
            {
                C_Trade.InTrade = false;
                PnlTradeVisible = false;

                NeedtoCloseTrade = false;
            }

            if (NeedtoUpdateTrade == true)
            {
                C_Trade.DrawTrade();
                NeedtoUpdateTrade = false;
            }

            if (UpdateCharacterPanel == true)
            {
                UpdateCharacterPanel = false;
            }

            if (Pnlloadvisible != FrmMenu.Default.pnlLoad.Visible)
            {
                FrmMenu.Default.pnlLoad.Visible = Pnlloadvisible;
            }

            if (UpdateMapnames == true)
            {
                int x = 0;

                FrmAdmin.Default.lstMaps.Items.Clear();

                for (x = 1; x <= Constants.MAX_MAPS; x++)
                {
                    FrmAdmin.Default.lstMaps.Items.Add(x.ToString());
                    FrmAdmin.Default.lstMaps.Items[x - 1].SubItems.Add(C_Types.MapNames[x]);
                }

                UpdateMapnames = false;
            }

            if (Adminvisible == true)
            {
                FrmAdmin.Default.Visible = !FrmAdmin.Default.Visible;
                Adminvisible             = false;
            }

            if (C_Quest.UpdateQuestChat == true)
            {
                C_Variables.DialogMsg1 = "Quest: " + Microsoft.VisualBasic.Strings.Trim(C_Quest.Quest[C_Quest.QuestNum].Name);
                C_Variables.DialogMsg2 = C_Quest.QuestMessage;

                C_Variables.DialogType = C_Constants.DialogueTypeQuest;

                if (C_Quest.QuestNumForStart > 0 && C_Quest.QuestNumForStart <= C_Quest.MaxQuests)
                {
                    C_Quest.QuestAcceptTag = C_Quest.QuestNumForStart;
                }

                C_Variables.UpdateDialog = true;

                C_Quest.UpdateQuestChat = false;
            }

            if (C_Quest.UpdateQuestWindow == true)
            {
                C_Quest.LoadQuestlogBox();
                C_Quest.UpdateQuestWindow = false;
            }

            if (C_Variables.UpdateDialog == true)
            {
                if (C_Variables.DialogType == C_Constants.DialogueTypeBuyhome || C_Variables.DialogType == C_Constants.DialogueTypeVisit)                 //house offer & visit
                {
                    C_Variables.DialogButton1Text = "Accept";
                    C_Variables.DialogButton2Text = "Decline";
                    DialogPanelVisible            = true;
                }
                else if (C_Variables.DialogType == C_Constants.DialogueTypeParty || C_Variables.DialogType == C_Constants.DialogueTypeTrade)
                {
                    C_Variables.DialogButton1Text = "Accept";
                    C_Variables.DialogButton2Text = "Decline";
                    DialogPanelVisible            = true;
                }
                else if (C_Variables.DialogType == C_Constants.DialogueTypeQuest)
                {
                    C_Variables.DialogButton1Text = "Accept";
                    C_Variables.DialogButton2Text = "Ok";
                    if (C_Quest.QuestAcceptTag > 0)
                    {
                        C_Variables.DialogButton2Text = "Decline";
                    }
                    DialogPanelVisible = true;
                }

                C_Variables.UpdateDialog = false;
            }

            if (C_EventSystem.EventChat == true)
            {
                PnlEventChatVisible     = true;
                C_EventSystem.EventChat = false;
            }

            if (C_Variables.ShowRClick == true)
            {
                RClickname       = C_Types.Player[C_Variables.MyTarget].Name;
                RClickX          = C_Graphics.ConvertMapX(C_Variables.CurX * C_Constants.PicX);
                RClickY          = C_Graphics.ConvertMapY(C_Variables.CurY * C_Constants.PicY);
                PnlRClickVisible = true;

                C_Variables.ShowRClick = false;
            }

            if (InitMapEditor == true)
            {
                FrmEditor_MapEditor.Default.MapEditorInit();
                InitMapEditor = false;
            }

            if (InitMapProperties == true)
            {
                FrmEditor_MapEditor.Default.MapPropertiesInit();
                InitMapProperties = false;
            }

            if (C_EventSystem.InitEventEditorForm == true)
            {
                FrmEditor_Events.Default.InitEventEditorForm();

                // populate form
                // set the tabs
                if (FrmEditor_Events.Default.tabPages != null && FrmEditor_Events.Default.tabPages.TabPages != null)
                {
                    FrmEditor_Events.Default.tabPages.TabPages.Clear();

                    for (var i = 1; i <= C_EventSystem.TmpEvent.PageCount; i++)
                    {
                        FrmEditor_Events.Default.tabPages.TabPages.Add(Conversion.Str(i));
                    }
                    // items
                    FrmEditor_Events.Default.cmbHasItem.Items.Clear();
                    FrmEditor_Events.Default.cmbHasItem.Items.Add("None");
                    for (var i = 1; i <= Constants.MAX_ITEMS; i++)
                    {
                        FrmEditor_Events.Default.cmbHasItem.Items.Add(i + ": " + Microsoft.VisualBasic.Strings.Trim(Types.Item[(int)i].Name));
                    }
                    // variables
                    FrmEditor_Events.Default.cmbPlayerVar.Items.Clear();
                    FrmEditor_Events.Default.cmbPlayerVar.Items.Add("None");
                    for (var i = 1; i <= C_EventSystem.MaxVariables; i++)
                    {
                        FrmEditor_Events.Default.cmbPlayerVar.Items.Add(i + ". " + C_EventSystem.Variables[(int)i]);
                    }
                    // variables
                    FrmEditor_Events.Default.cmbPlayerSwitch.Items.Clear();
                    FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add("None");
                    for (var i = 1; i <= C_EventSystem.MaxSwitches; i++)
                    {
                        FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add(i + ". " + C_EventSystem.Switches[(int)i]);
                    }
                    // name
                    FrmEditor_Events.Default.txtName.Text = C_EventSystem.TmpEvent.Name;
                    // enable delete button
                    if (C_EventSystem.TmpEvent.PageCount > 1)
                    {
                        FrmEditor_Events.Default.btnDeletePage.Enabled = true;
                    }
                    else
                    {
                        FrmEditor_Events.Default.btnDeletePage.Enabled = false;
                    }
                    FrmEditor_Events.Default.btnPastePage.Enabled = false;
                    // Load page 1 to start off with
                    C_EventSystem.CurPageNum = 1;
                    C_EventSystem.EventEditorLoadPage(C_EventSystem.CurPageNum);

                    FrmEditor_Events.Default.nudShowTextFace.Maximum    = C_Graphics.NumFaces;
                    FrmEditor_Events.Default.nudShowChoicesFace.Maximum = C_Graphics.NumFaces;
                    // show the editor
                    FrmEditor_Events.Default.Show();

                    C_EventSystem.InitEventEditorForm = false;
                }
            }

            if (OptionsVisible == true)
            {
                // show in GUI
                if (C_Types.Options.Music == 1)
                {
                    FrmOptions.Default.optMOn.Checked = true;
                }
                else
                {
                    FrmOptions.Default.optMOff.Checked = true;
                }

                if (C_Types.Options.Music == 1)
                {
                    FrmOptions.Default.optSOn.Checked = true;
                }
                else
                {
                    FrmOptions.Default.optSOff.Checked = true;
                }

                FrmOptions.Default.lblVolume.Text   = "Volume: " + System.Convert.ToString(C_Types.Options.Volume);
                FrmOptions.Default.scrlVolume.Value = (int)C_Types.Options.Volume;

                FrmOptions.Default.cmbScreenSize.SelectedIndex = C_Types.Options.ScreenSize;

                if (C_Types.Options.VSync == 1)
                {
                    FrmOptions.Default.chkVSync.Checked = true;
                }
                else
                {
                    FrmOptions.Default.chkVSync.Checked = false;
                }

                if (C_Types.Options.UnlockFPS == 1)
                {
                    FrmOptions.Default.checkBox1.Checked = true;
                }
                else
                {
                    FrmOptions.Default.checkBox1.Checked = false;
                }

                if (C_Types.Options.ShowNpcBar == 1)
                {
                    FrmOptions.Default.chkNpcBars.Checked = true;
                }
                else
                {
                    FrmOptions.Default.chkNpcBars.Checked = false;
                }

                FrmOptions.Default.Visible = true;
                OptionsVisible             = false;
            }
        }
Exemplo n.º 3
0
        public void Picscreen_MouseDown(object sender, MouseEventArgs e)
        {
            if (!C_GuiFunctions.CheckGuiClick(e.X, e.Y, e))
            {
                if (C_Constants.InMapEditor)
                {
                    FrmEditor_MapEditor.Default.MapEditorMouseDown((System.Int32)e.Button, e.X, e.Y, false);
                }

                // left click
                if (e.Button == MouseButtons.Left)
                {
                    // if we're in the middle of choose the trade target or not
                    if (!C_Trade.TradeRequest)
                    {
                        if (C_Pets.PetAlive(C_Variables.Myindex))
                        {
                            if (C_GameLogic.IsInBounds())
                            {
                                C_Pets.PetMove(C_Variables.CurX, C_Variables.CurY);
                            }
                        }
                        // targetting
                        C_NetworkSend.PlayerSearch(C_Variables.CurX, C_Variables.CurY, (byte)0);
                    }
                    else
                    {
                        // trading
                        C_Trade.SendTradeRequest(C_Types.Player[C_Variables.MyTarget].Name);
                    }
                    C_UpdateUI.PnlRClickVisible = false;
                    C_Pets.ShowPetStats         = false;

                    // right click
                }
                else if (e.Button == MouseButtons.Right)
                {
                    if (C_Variables.ShiftDown || C_UpdateUI.VbKeyShift == true)
                    {
                        // admin warp if we're pressing shift and right clicking
                        if (C_Player.GetPlayerAccess(C_Variables.Myindex) >= 2)
                        {
                            C_NetworkSend.AdminWarp(C_Variables.CurX, C_Variables.CurY);
                        }
                    }
                    else
                    {
                        // rightclick menu
                        if (C_Pets.PetAlive(C_Variables.Myindex))
                        {
                            if (C_GameLogic.IsInBounds() && C_Variables.CurX == C_Types.Player[C_Variables.Myindex].Pet.X & C_Variables.CurY == C_Types.Player[C_Variables.Myindex].Pet.Y)
                            {
                                C_Pets.ShowPetStats = true;
                            }
                        }
                        else
                        {
                            C_NetworkSend.PlayerSearch(C_Variables.CurX, C_Variables.CurY, (byte)1);
                        }
                    }
                    C_Housing.FurnitureSelected = 0;
                }
            }

            C_GuiFunctions.CheckGuiMouseDown(e.X, e.Y, e);

            if (!FrmAdmin.Default.Visible || !FrmOptions.Default.Visible)
            {
                Focus();
            }
        }