示例#1
0
        private async void LoadLinks()
        {
            List <CTeleportLink> linkList = await CTeleportLink.GetTeleportLinks();

            HashSet <string> tpCodeNames = await CTeleport.GetTeleportCodeNames();

            List <string> restrictList = new List <string>()
            {
                "None", "Level Limit", "Block Enter With Job Pet", "Need Item to Enter", "Delete Item After Enter", "Block Enter With Job Suit", "Block Enter to Thief Trade Pet"
            };

            Globals.SetDataGridComboBoxColumn(1, tpCodeNames.ToList(), _linkgrid);
            Globals.SetDataGridComboBoxColumn(2, tpCodeNames.ToList(), _linkgrid);

            Globals.SetDataGridComboBoxColumn(4, restrictList, _linkgrid);
            Globals.SetDataGridComboBoxColumn(7, restrictList, _linkgrid);
            Globals.SetDataGridComboBoxColumn(10, restrictList, _linkgrid);
            Globals.SetDataGridComboBoxColumn(13, restrictList, _linkgrid);
            Globals.SetDataGridComboBoxColumn(16, restrictList, _linkgrid);

            linkList.ForEach(link =>
            {
                int i = _linkgrid.Rows.Add(link.m_Service == 1, link.m_OwnerTeleport, link.m_TargetTeleport, link.m_Fee, GetRestrictDesc(link.Restrict1.m_RestrictType),
                                           link.Restrict1.m_Data1, link.Restrict1.m_Data2, GetRestrictDesc(link.Restrict2.m_RestrictType), link.Restrict2.m_Data1, link.Restrict2.m_Data2, GetRestrictDesc(link.Restrict3.m_RestrictType),
                                           link.Restrict3.m_Data1, link.Restrict3.m_Data2, GetRestrictDesc(link.Restrict4.m_RestrictType), link.Restrict4.m_Data1, link.Restrict4.m_Data2, GetRestrictDesc(link.Restrict5.m_RestrictType),
                                           link.Restrict5.m_Data1, link.Restrict5.m_Data2);

                _linkgrid.Rows[i].Cells[1].ReadOnly = true;
                _linkgrid.Rows[i].Cells[2].ReadOnly = true;
                _linkgrid.Rows[i].Tag = link.m_Status;
            });
        }
示例#2
0
 private void cNewPortalButton_Click(object sender, EventArgs e)
 {
     SelectedTeleport = new CTeleport(EditStatus.New);
     ClearControls();
     ChangeStatus(true);
     cService.Checked  = true;
     cCodeName128.Text = "GATE_";
 }
示例#3
0
 private void cPortalList_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (cPortalList.SelectedIndex > -1)
     {
         SelectedTeleport = new CTeleport(cPortalList.SelectedItem.ToString());
         ParseSelectedTeleport();
         ChangeStatus(true);
     }
 }
示例#4
0
        private void cSaveButton_Click(object sender, EventArgs e)
        {
            if (cCodeName128.Text.Length > 0 &&
                cWorldList.SelectedIndex > -1 &&
                cRegionID.Text.Length > 0 &&
                cPosX.Text.Length > 0 &&
                cPosY.Text.Length > 0 &&
                cPosZ.Text.Length > 0 &&
                cGenAreaRadius.Text.Length > 0 &&
                cBindInteractionMask.Text.Length > 0 &&
                cFixedService.Text.Length > 0)
            {
                if (MessageBox.Show("Are you sure that you want to save changes to database?", "WARNING!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (SelectedTeleport.m_Status == EditStatus.New)
                    {
                        if (CTeleport.IsExistsTeleport(cCodeName128.Text))
                        {
                            MessageBox.Show("A Teleport already exists with that codename, try again!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }

                    SelectedTeleport.m_Service               = cService.Checked ? 1 : 0;
                    SelectedTeleport.m_CodeName128           = cCodeName128.Text.Trim();
                    SelectedTeleport.m_AssocRefObjCodeName   = cAssocObjectName.Text.Length > 0 ? cAssocObjectName.Text : "xxx";
                    SelectedTeleport.m_ZoneName128           = cZoneName128.Text.Length > 0 ? cZoneName128.Text : "xxx";
                    SelectedTeleport.m_GenWorldID            = (short)Globals.GameWorldIDList[cWorldList.SelectedItem.ToString()];
                    SelectedTeleport.m_GenRegionID           = Convert.ToInt16(cRegionID.Text);
                    SelectedTeleport.m_GenPos_X              = Convert.ToInt16(cPosX.Text);
                    SelectedTeleport.m_GenPos_Y              = Convert.ToInt16(cPosY.Text);
                    SelectedTeleport.m_GenPos_Z              = Convert.ToInt16(cPosZ.Text);
                    SelectedTeleport.m_GenAreaRadius         = Convert.ToInt16(cGenAreaRadius.Text);
                    SelectedTeleport.m_BindInteractionMask   = Convert.ToByte(cBindInteractionMask.Text);
                    SelectedTeleport.m_FixedService          = Convert.ToByte(cFixedService.Text);
                    SelectedTeleport.m_CanBeResurrectPos     = cCanBeReturnPoint.Checked;
                    SelectedTeleport.m_CanBeGotoResurrectPos = cCanGoResurrectPoint.Checked;

                    if (SelectedTeleport.m_Status != EditStatus.New)
                    {
                        SelectedTeleport.m_Status = EditStatus.Edited;
                    }

                    SelectedTeleport.SaveToDatabase();
                    cID.Text = SelectedTeleport.m_ID.ToString();
                    CTeleportBase.SaveToClient("teleportdata.txt");
                    MessageBox.Show("Your changes is successfully saved!", "NOTICE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("All fields cannot be empty!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        private async Task GetTeleportCodeNames()
        {
            HashSet <string> codenames = await CTeleport.GetTeleportCodeNames();

            codenames.ForEach(codename =>
            {
                if (cPortalList.InvokeRequired)
                {
                    cPortalList.BeginInvoke((Action)(() => cPortalList.Items.Add(codename)));
                }
                else
                {
                    cPortalList.Items.Add(codename);
                }
            });
        }