Beispiel #1
0
        /// <summary>
        /// List of Attributes on Equipment(including descriptions)
        /// </summary>
        /// <param name="weaponInfo">Equipment Object</param>
        /// <param name="attInfoList">Description of Properties</param>
        /// <returns>List of Attributes</returns>
        public List <AttributeMemoryInfo> GetAttList(ItemMemoryInfo weaponInfo, List <AttributeInfo> attInfoList)
        {
            if (br.BtList == null)
            {
                throw new Exception("Save file not open.");
            }

            List <AttributeMemoryInfo> attList = weaponInfo.ItemAttList;

            foreach (AttributeMemoryInfo attInfo in attList)
            {
                String text = "";
                foreach (AttributeInfo att in attInfoList)
                {
                    if (att.AttributeId == attInfo.Code)
                    {
                        text = att.AttributeText;
                    }
                }
                if (text == "")
                {
                    text = "Unknown";
                }
                attInfo.Detail = text;
            }
            return(attList);
        }
Beispiel #2
0
        /// <summary>
        /// Check if equipment is Equipable
        /// </summary>
        /// <param name="weapon">Equipment Object</param>
        /// <returns></returns>
        public bool IsWeapon(ItemMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("Save file not open.");
            }

            byte[] bytes = new byte[9];
            bytes[0] = 11;
            bytes[1] = 0;
            bytes[2] = 0;
            bytes[3] = 0;
            bytes[4] = 104;
            bytes[5] = 213;
            bytes[6] = 36;
            bytes[7] = 0;
            bytes[8] = 3;
            try
            {
                return(br.HasBytesByIndexAndLength(bytes, weapon.ItemIndex + 4, 17));
            }
            catch
            {
                return(false);
            }
        }
Beispiel #3
0
 public ItemBytesForm(AmalurSaveEditor editer, ItemMemoryInfo weapon)
 {
     InitializeComponent();
     this.weapon = weapon;
     this.editer = editer;
     FormatAll();
 }
Beispiel #4
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Removing equipment forcefully may lead to bugs. Removing equipped items will lead to an invalid save. It is recommended not to use this feature.\n\nAre you sure you want to delete this item?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         ItemMemoryInfo weaponInfo = (ItemMemoryInfo)lvMain.SelectedItems[0].Tag;
         editor.DeleteWeapon(weaponInfo);
     }
 }
Beispiel #5
0
        public EditForm(AmalurSaveEditor editor, List <AttributeInfo> attList, ItemMemoryInfo weaponInfo)
        {
            InitializeComponent();
            this.editor        = editor;
            this.attributeList = attList;
            this.weaponInfo    = weaponInfo;

            FormatAll(attList);
        }
Beispiel #6
0
        /// <summary>
        /// Saveing Equipment
        /// </summary>
        /// <param name="weapon">Written Equipment</param>
        public void WriteWeaponByte(ItemMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("Save file not open.");
            }

            br.DeleteIntsByStartAndEnd(weapon.ItemIndex, weapon.NextItemIndex - 1);
            br.AddByIndex(weapon.ItemIndex, weapon.ItemBytes);
        }
Beispiel #7
0
        /// <summary>
        /// Delete Equipment
        /// </summary>
        /// <param name="weapon"></param>
        public void DeleteWeapon(ItemMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("Save file not open.");
            }

            weapon.ItemBytes = new byte[] { 0, 0, 0, 0 };
            WriteWeaponByte(weapon);
        }
Beispiel #8
0
        private void AddAttribute(ItemMemoryInfo selectedItem, string attCode)
        {
            List <AttributeMemoryInfo> attList = selectedItem.ItemAttList;
            AttributeMemoryInfo        attInfo = new AttributeMemoryInfo();

            attInfo.Code = attCode;
            attList.Add(attInfo);
            selectedItem.ItemAttList = attList;
            LoadItemAttributesOnClick();
        }
Beispiel #9
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            ItemMemoryInfo weaponInfo = (ItemMemoryInfo)lvMain.SelectedItems[0].Tag;

            //EditForm form = new EditForm(editor, attributeList, itemInfo);
            //btnPrint.Enabled = false;
            //btnEdit.Enabled = false;
            //btnDelete.Enabled = false;
            //if (form.ShowDialog() == DialogResult.Yes)
            //{
            //    CanSave();
            //}
        }
Beispiel #10
0
        private void BtnShowAll_Click(object sender, EventArgs e)
        {
            ResetFilterFields();
            lvMain.Items.Clear();
            if (editor == null)
            {
                MessageBox.Show("No save file opened! Click OK to open a save file.");
                tsmiOpen.PerformClick();
            }
            else
            {
                List <ItemMemoryInfo> weaponTemp = editor.GetAllWeapon();

                itemList = new List <ItemMemoryInfo>();
                foreach (ItemMemoryInfo w in weaponTemp)
                {
                    if (w.ItemName == "Unknown")
                    {
                        itemList.Add(w);
                    }
                    else
                    {
                        itemList.Insert(0, w);
                    }
                }
                foreach (ItemMemoryInfo w in itemList)
                {
                    ListViewItem item = new ListViewItem();
                    item.Name = w.ItemIndex.ToString();
                    item.Text = w.ItemIndex.ToString();
                    item.SubItems.Add(w.ItemName);
                    item.SubItems.Add(w.CurrentDurability.ToString());
                    item.SubItems.Add(w.MaxDurability.ToString());
                    item.SubItems.Add(w.AttCount.ToString());
                    item.Tag = w;
                    lvMain.Items.Add(item);
                }
                btnPrint.Enabled         = false;
                btnDelete.Enabled        = false;
                btnSave.Enabled          = false;
                txtFilterItemName.Text   = "";
                txtFilterMaxDur.Text     = "";
                txtFilterCurrentDur.Text = "";
                lvMain.SelectedItems.Clear();
                this.selectedItem = null;
            }
        }
Beispiel #11
0
        private void LoadItemAttributesOnClick()
        {
            ItemMemoryInfo             itemInfo    = (ItemMemoryInfo)lvMain.SelectedItems[0].Tag;
            List <AttributeMemoryInfo> itemAttList = editor.GetAttList(itemInfo, this.attributeList);

            this.selectedItem = itemInfo;

            this.txtPropName.Text     = itemInfo.ItemName;
            this.txtPropCurrDur.Text  = itemInfo.CurrentDurability.ToString();
            this.txtPropMaxDur.Text   = itemInfo.MaxDurability.ToString();
            this.txtPropAttCount.Text = itemInfo.AttCount.ToString();

            this.comboExistingAttList.DisplayMember = "Detail";
            this.comboExistingAttList.DataSource    = itemAttList;

            this.comboAddAttList.DisplayMember = "AttributeText";
            this.comboAddAttList.ValueMember   = "AttributeId";
            this.comboAddAttList.DataSource    = this.attributeList;
        }
Beispiel #12
0
        private void DeleteItemAttribute()
        {
            ItemMemoryInfo             itemInfo          = (ItemMemoryInfo)lvMain.SelectedItems[0].Tag;
            List <AttributeMemoryInfo> itemAttList       = itemInfo.ItemAttList;
            AttributeMemoryInfo        selectedAttribute = (AttributeMemoryInfo)comboExistingAttList.SelectedItem;

            foreach (AttributeMemoryInfo att in itemAttList)
            {
                if (att.Code.ToUpper() == selectedAttribute.Code.ToUpper())
                {
                    itemAttList.Remove(att);
                    break;
                }
            }

            itemInfo.ItemAttList      = itemAttList;
            this.txtPropAttCount.Text = itemAttList.Count.ToString();
            if (itemAttList.Count <= 0)
            {
                this.txtPropSelectedAttributeHexCode.Text = "";
            }
            LoadItemAttributesOnClick();
        }
Beispiel #13
0
        private void LoadItemAttributes(ItemMemoryInfo itemInfo)
        {
            List <AttributeMemoryInfo> attList = editor.GetAttList(itemInfo, this.attributeList);
            List <AttributeMemoryInfo> temp    = new List <AttributeMemoryInfo>();

            foreach (AttributeMemoryInfo att in attList)
            {
                bool isAtt = false;
                foreach (AttributeMemoryInfo t in temp)
                {
                    if (t.Code == att.Code)
                    {
                        isAtt = true;
                        break;
                    }
                }
                if (!isAtt)
                {
                    temp.Add(att);
                }
            }
            comboExistingAttList.DataSource = null;
            comboExistingAttList.DataSource = temp;
        }
Beispiel #14
0
        /// <summary>
        /// Get all Equipment
        /// </summary>
        /// <returns></returns>
        public List <ItemMemoryInfo> GetAllWeapon()
        {
            if (br.BtList == null)
            {
                throw new Exception("Save file not open.");
            }

            List <ItemMemoryInfo> weaponList = new List <ItemMemoryInfo>();

            byte[] bytes = new byte[9];
            bytes[0] = 11;
            bytes[1] = 0;
            bytes[2] = 0;
            bytes[3] = 0;
            bytes[4] = 104;
            bytes[5] = 213;
            bytes[6] = 36;
            bytes[7] = 0;
            bytes[8] = 3;
            List <int> indexList = br.FindIndexList(bytes);

            for (int i = 0; i < indexList.Count; i++)
            {
                indexList[i] -= 4;
            }

            for (int i = 0; i < indexList.Count; i++)
            {
                if (i != indexList.Count - 1)
                {
                    if (indexList[i + 1] - indexList[i] < 44)
                    {
                        continue;
                    }
                }

                ItemMemoryInfo weapon = new ItemMemoryInfo();
                weapon.ItemIndex = indexList[i];
                if (i != indexList.Count - 1)
                {
                    weapon.NextItemIndex = indexList[i + 1];
                    weapon.ItemBytes     = br.GetBytesByIndexAndLength(indexList[i], indexList[i + 1] - indexList[i]);

                    if (weapon.CurrentDurability != 100 && weapon.MaxDurability != -1 && weapon.MaxDurability != 100 && weapon.CurrentDurability != 0 && weapon.MaxDurability != 0)
                    {
                        weaponList.Add(weapon);
                    }
                    else
                    {
                        continue;
                    }
                }
                else
                {
                    int attHeadIndex = weapon.ItemIndex + AmalurSaveEditor.ItemAttHeadOffSet;
                    int attCount     = BitConverter.ToInt32(br.BtList, attHeadIndex);
                    int endIndex     = 0;
                    if (br.BtList[attHeadIndex + 22 + attCount * 8] != 1)
                    {
                        endIndex = attHeadIndex + 22 + attCount * 8;
                    }
                    else
                    {
                        int nameLength = 0;
                        nameLength = BitConverter.ToInt32(br.BtList, attHeadIndex + 22 + attCount * 8 + 1);
                        endIndex   = attHeadIndex + 22 + attCount * 8 + nameLength + 4;
                    }
                    weapon.ItemBytes = br.GetBytesByIndexAndLength(weapon.ItemIndex, endIndex - weapon.ItemIndex + 1);
                    if (weapon.CurrentDurability != 100 && weapon.MaxDurability != -1 && weapon.MaxDurability != 100 && weapon.CurrentDurability != 0 && weapon.MaxDurability != 0)
                    {
                        weaponList.Add(weapon);
                    }
                    else
                    {
                        continue;
                    }
                }
            }

            return(weaponList);
        }