Exemple #1
0
        private void EditString(TreeNode sourceNode)
        {
            if (_stringEditMode != EditMode.None)
            {
                if (tbStringValue.Text != (((tbStringValue.Tag as TreeNode).Tag as AceObjectPropertiesString).PropertyValue))
                {
                    // unsaved changes
                    MessageBox.Show("Unsaved String changes detected.  Save or Cancel first.");
                    return;
                }
            }
            else
            {
                // only adjust if we're opening it from a closed state
                tvStrings.Height -= pEditString.Height;
            }

            AceObjectPropertiesString prop = sourceNode.Tag as AceObjectPropertiesString;

            _stringEditMode     = EditMode.Edit;
            pEditString.Visible = true;
            cbStringProperties.SelectedValue = (int?)prop.PropertyId;
            tbStringValue.Text         = prop.PropertyValue;
            tbStringValue.Tag          = sourceNode;
            cbStringProperties.Enabled = false;
        }
Exemple #2
0
        private void btnSaveString_Click(object sender, EventArgs e)
        {
            TreeNode node = null;
            AceObjectPropertiesString prop = null;

            if (_stringEditMode == EditMode.Edit)
            {
                node = (TreeNode)tbStringValue.Tag;
                prop = node.Tag as AceObjectPropertiesString;
                prop.PropertyValue = tbStringValue.Text;
                node.Text          = ((PropertyString)prop.PropertyId) + " - " + prop.PropertyValue;
            }
            else
            {
                prop               = new AceObjectPropertiesString();
                prop.AceObjectId   = _weenie.WeenieClassId;
                prop.PropertyId    = Convert.ToUInt16((int)cbStringProperties.SelectedValue);
                prop.PropertyValue = tbStringValue.Text;
                _weenie.StringProperties.Add(prop);
                node = CreateStringNode(prop);
                tvStrings.Nodes.Add(node);
            }

            // TODO: save change to change-list.  object structure will be dirty

            tvStrings.Height   += pEditString.Height;
            pEditString.Visible = false;
            _stringEditMode     = EditMode.None;
        }
Exemple #3
0
        private TreeNode CreateStringNode(AceObjectPropertiesString prop)
        {
            TreeNode node = new TreeNode();

            node.Text             = ((PropertyString)prop.PropertyId).ToString() + " - " + prop.PropertyValue;
            node.Tag              = prop;
            node.ContextMenuStrip = cmsString;
            return(node);
        }
Exemple #4
0
        public Scroll(AceObject aceObject)
            : base(aceObject)
        {
            Attackable = true;

            SetObjectDescriptionBools();

            var table = DatManager.PortalDat.SpellTable;

            Use  = $"Inscribed spell: {table.Spells[SpellId].Name}\n";
            Use += $"{table.Spells[SpellId].Desc}";

            LongDesc = "Use this item to attempt to learn its spell.";

            Power  = table.Spells[SpellId].Power;
            School = table.Spells[SpellId].School;

            Burden = 30;

            switch (Power)
            {
            case spellLevel1:
                Value = 1;
                break;

            case spellLevel2:
                Value = 5;
                break;

            case spellLevel3:
                Value = 20;
                break;

            case spellLevel4:
                Value = 100;
                break;

            case spellLevel5:
                Value = 200;
                break;

            case spellLevel6:
                Value = 1000;
                break;

            case spellLevel7:
                Value = 2000;
                break;

            case spellLevel8:
                Value = 60000;
                break;
            }

            ScrollPropertiesInt = PropertiesInt.Where(x => x.PropertyId == (uint)PropertyInt.Value ||
                                                      x.PropertyId == (uint)PropertyInt.EncumbranceVal).ToList();

            if (ScrollPropertiesString == null)
            {
                ScrollPropertiesString = new List <AceObjectPropertiesString>();
            }
            if (ScrollPropertiesSpellId == null)
            {
                ScrollPropertiesSpellId = new List <AceObjectPropertiesSpell>();
            }

            var useString = new AceObjectPropertiesString();

            useString.AceObjectId   = Guid.Full;
            useString.PropertyId    = (ushort)PropertyString.Use;
            useString.PropertyValue = Use;
            ScrollPropertiesString.Add(useString);

            var longDescString = new AceObjectPropertiesString();

            longDescString.AceObjectId   = Guid.Full;
            longDescString.PropertyId    = (ushort)PropertyString.LongDesc;
            longDescString.PropertyValue = LongDesc;
            ScrollPropertiesString.Add(longDescString);

            var propSpell = new AceObjectPropertiesSpell();

            propSpell.AceObjectId = Guid.Full;
            propSpell.SpellId     = SpellId;
            ScrollPropertiesSpellId.Add(propSpell);
        }