Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (nextAcct >= 0xFFFF)
            {
                MessageBox.Show("Error: UOX3 Only Supports Accounts with numbers 0-65534!", "Failure");
                return;
            }

            AccountObject newAcct = new AccountObject(nextAcct);
            string        name    = "guest" + nextAcct.ToString();

            if (nextAcct == 0)
            {
                name = "admin";
                newAcct.SetFlag(0x8000, true);
            }

            newAcct.Name = name;
            newAcct.Pass = name;
            accountList.Add(name, newAcct);
            listAccounts.Items.Add(name + " (" + nextAcct.ToString() + ")");
            listAccounts.SelectedIndex = listAccounts.Items.Count - 1;
            ++nextAcct;
            ++numAccts;

            UpdateStats();
        }
Ejemplo n.º 2
0
        public void UpdateList(AccountObject toDisp)
        {
            listCharacters.Items.Clear();
            listCharacters.Update();

            assocAcct = toDisp;
            foreach (SlotObject slotObj in toDisp.CharSlots)
            {
                listCharacters.Items.Add(slotObj.Name);
            }

            if (listCharacters.Items.Count > 0)
            {
                listCharacters.SelectedIndex = 0;
            }

            listOrphans.Items.Clear();
            listOrphans.Update();
            txtOrphName.Clear();
            txtOrphSerial.Clear();
            btnRestore.Enabled = false;

            foreach (SlotObject orphObj in toDisp.OrphanChars)
            {
                listOrphans.Items.Add(orphObj.Name);
            }
        }
Ejemplo n.º 3
0
 public CharacterEditor()
 {
     assocAcct = null;
     selSlot   = null;
     selOrph   = null;
     InitializeComponent();
 }
Ejemplo n.º 4
0
 public AccountManager()
 {
     InitializeComponent();
     accountList = new Dictionary <string, AccountObject>();
     myForm      = new CharacterEditor();
     selAcct     = null;
     nextAcct    = 0;
     numAccts    = 0;
     numPlayers  = 0;
     numBans     = 0;
     UpdateStats();
 }
Ejemplo n.º 5
0
        public void Clear()
        {
            assocAcct = null;
            selSlot   = null;
            selOrph   = null;

            listCharacters.Items.Clear();
            listCharacters.Update();
            txtCharName.Clear();
            txtCharSer.Clear();
            cbBlockSlot.Checked = false;
            listOrphans.Items.Clear();
            listOrphans.Update();
            txtOrphName.Clear();
            txtOrphSerial.Clear();
            btnRestore.Enabled = false;
        }
Ejemplo n.º 6
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            fldrAccounts.Description = "Please Select the UOX3 Accounts Directory to Load.";
            if (fldrAccounts.ShowDialog() == DialogResult.OK)
            {
                string dirPath = fldrAccounts.SelectedPath + "\\accounts.adm";
                accountList.Clear();
                listAccounts.Items.Clear();
                if (myForm.Visible)
                {
                    myForm.Clear();
                }
                txtAccountsDir.Text = fldrAccounts.SelectedPath;
                listAccounts.Update();
                txtAccountsDir.Update();

                progressBar.Minimum = 0;
                if (File.Exists(dirPath))
                {
                    progressBar.Value = 1;
                    UOXData.Script.AccountScript mScript = new UOXData.Script.AccountScript(dirPath);
                    progressBar.Maximum = mScript.Sections.Count;
                    foreach (UOXData.Script.AccountSection mSect in mScript.Sections)
                    {
                        ushort acctNum = UOXData.Conversion.ToUInt16(mSect.SectionName);
                        if (acctNum >= nextAcct)
                        {
                            nextAcct = acctNum + 1;
                        }
                        AccountObject toAdd = new AccountObject(acctNum);
                        foreach (UOXData.Script.TagDataPair mPair in mSect.TagDataPairs)
                        {
                            string mTag  = mPair.Tag.ToUpper();
                            string mData = mPair.Data;

                            switch (mTag)
                            {
                            case "NAME":
                                toAdd.Name = mData;
                                break;

                            case "PASS":
                                toAdd.Pass = mData;
                                break;

                            case "FLAGS":
                                toAdd.Flags = UOXData.Conversion.ToUInt16(mData);
                                break;

                            case "PATH":
                                toAdd.Path = mData;
                                break;

                            case "CONTACT":
                                toAdd.Contact = mData;
                                break;

                            case "TIMEBAN":
                                toAdd.TimeBan = UOXData.Conversion.ToUInt32(mData);
                                break;

                            case "CHARACTER-1":
                            case "CHARACTER-2":
                            case "CHARACTER-3":
                            case "CHARACTER-4":
                            case "CHARACTER-5":
                            case "CHARACTER-6":
                                string []  tagSplit = mTag.Split('-');
                                byte       charNum  = (byte)(UOXData.Conversion.ToUInt08(tagSplit[1]) - 1);
                                SlotObject mSlot    = toAdd.CharSlots[charNum];

                                string[] dataSplit = mData.Split(' ');
                                mSlot.Serial = UOXData.Conversion.ToUInt32(dataSplit[0]);
                                if (dataSplit[1].Length > 0)
                                {
                                    mSlot.Name = dataSplit[1].Substring(1, dataSplit[1].Length - 2);
                                }

                                if (mSlot.Serial != 0xFFFFFFFF)
                                {
                                    ++numPlayers;
                                }
                                break;

                            default:
                                break;
                            }
                        }
                        if (toAdd.GetFlag(0x0001))
                        {
                            ++numBans;
                        }
                        accountList.Add(toAdd.Name, toAdd);
                        ++numAccts;
                        listAccounts.Items.Add(toAdd.Name + " (" + mSect.SectionName + ")");
                        progressBar.PerformStep();
                    }

                    LoadOrphans();

                    UpdateStats();

                    if (listAccounts.Items.Count > 0)
                    {
                        listAccounts.SelectedIndex = 0;
                    }
                    else
                    {
                        listAccounts.Items.Add("No Accounts to Display");
                    }
                }
                else
                {
                    MessageBox.Show("Accounts.adm not found, please select a valid directory", "File Not Found");
                }
            }
        }
Ejemplo n.º 7
0
        private void listAccounts_SelectedIndexChanged(object sender, EventArgs e)
        {
            selAcct             = null;
            cbPublic.Checked    = false;
            rdBanned.Checked    = false;
            rdSuspended.Checked = false;
            rdPlayer.Checked    = true;

            if (listAccounts.SelectedIndex == -1)
            {
                txtName.Clear();
                txtPass.Clear();
                txtPath.Clear();
                txtContact.Clear();
                txtTimeban.Clear();
                if (myForm.Visible)
                {
                    myForm.Clear();
                }
                return;
            }

            AccountObject tmpAcct = accountList[listAccounts.SelectedItem.ToString().Split(' ')[0]];

            txtName.Text    = tmpAcct.Name;
            txtPass.Text    = tmpAcct.Pass;
            txtPath.Text    = tmpAcct.Path;
            txtContact.Text = tmpAcct.Contact;
            txtTimeban.Text = tmpAcct.TimeBan.ToString();
            if (tmpAcct.GetFlag(0x0004))
            {
                cbPublic.Checked = true;
            }

            if (tmpAcct.GetFlag(0x8000))
            {
                rdGM.Checked = true;
            }
            else if (tmpAcct.GetFlag(0x4000))
            {
                rdCns.Checked = true;
            }
            else if (tmpAcct.GetFlag(0x2000))
            {
                rdSeer.Checked = true;
            }

            if (tmpAcct.GetFlag(0x0001))
            {
                rdBanned.Checked = true;
            }
            else if (tmpAcct.GetFlag(0x0002))
            {
                rdSuspended.Checked = true;
            }

            if (myForm.Visible)
            {
                myForm.UpdateList(tmpAcct);
            }

            selAcct = tmpAcct;
        }