public WeaponBytesForm(AmalurSaveEditer editer, WeaponMemoryInfo weapon)
 {
     InitializeComponent();
     this.weapon = weapon;
     this.editer = editer;
     FormatAll();
 }
        /// <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(WeaponMemoryInfo weaponInfo, List <AttributeInfo> attInfoList)
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

            List <AttributeMemoryInfo> attList = weaponInfo.WeaponAttList;

            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);
        }
        /// <summary>
        /// Check if equipment is Equipable
        /// </summary>
        /// <param name="weapon">Equipment Object</param>
        /// <returns></returns>
        public bool IsWeapon(WeaponMemoryInfo 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.WeaponIndex + 4, 17));
            }
            catch
            {
                return(false);
            }
        }
示例#4
0
 public WeaponBytesForm(AmalurSaveEditer editer, WeaponMemoryInfo weapon)
 {
     InitializeComponent();
     this.weapon = weapon;
     this.editer = editer;
     FormatAll();
 }
示例#5
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Removing equipment forcefully may lead to bugs, removing worn-equipment will lead to an invalid save-file, if it is not absolutly necessary, do not use this feature, are you sure you want to delete you item?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         WeaponMemoryInfo weaponInfo = (WeaponMemoryInfo)lvMain.SelectedItems[0].Tag;
         editer.DeleteWeapon(weaponInfo);
         CanSave();
     }
 }
        public EditForm(AmalurSaveEditer editer, List<AttributeInfo> attList, WeaponMemoryInfo weaponInfo)
        {
            InitializeComponent();
            this.editer = editer;
            this.attributeList = attList;
            this.weaponInfo = weaponInfo;

            FormatAll();
        }
        public EditForm(AmalurSaveEditer editer, List <AttributeInfo> attList, WeaponMemoryInfo weaponInfo)
        {
            InitializeComponent();
            this.editer        = editer;
            this.attributeList = attList;
            this.weaponInfo    = weaponInfo;

            FormatAll();
        }
        /// <summary>
        /// Delete Equipment
        /// </summary>
        /// <param name="weapon"></param>
        public void DeleteWeapon(WeaponMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

            weapon.WeaponBytes = new byte[] {0,0,0,0 };
            WriteWeaponByte(weapon);
        }
        /// <summary>
        /// Saveing Equipment
        /// </summary>
        /// <param name="weapon">Written Equipment</param>
        public void WriteWeaponByte(WeaponMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

            br.DeleteIntsByStartAndEnd(weapon.WeaponIndex, weapon.NextWeaponIndex - 1);
            br.AddByIndex(weapon.WeaponIndex, weapon.WeaponBytes);
        }
        /// <summary>
        /// Delete Equipment
        /// </summary>
        /// <param name="weapon"></param>
        public void DeleteWeapon(WeaponMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

            weapon.WeaponBytes = new byte[] { 0, 0, 0, 0 };
            WriteWeaponByte(weapon);
        }
示例#11
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            WeaponMemoryInfo weaponInfo = (WeaponMemoryInfo)lvMain.SelectedItems[0].Tag;

            EditForm form = new EditForm(editer, attributeList, weaponInfo);

            btnPrint.Enabled  = false;
            btnEdit.Enabled   = false;
            btnDelete.Enabled = false;
            if (form.ShowDialog() == DialogResult.Yes)
            {
                CanSave();
            }
        }
        /// <summary>
        /// Get all Equipment
        /// </summary>
        /// <returns></returns>
        public List<WeaponMemoryInfo> GetAllWeapon()
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

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

            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;
                    }
                }

                WeaponMemoryInfo weapon = new WeaponMemoryInfo();
                weapon.WeaponIndex = indexList[i];
                if (i != indexList.Count - 1)
                {
                    weapon.NextWeaponIndex = indexList[i + 1];
                    weapon.WeaponBytes = br.GetBytsByIndexAndLength(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.WeaponIndex + AmalurSaveEditer.WeaponAttHeadOffSet;
                    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.WeaponBytes = br.GetBytsByIndexAndLength(weapon.WeaponIndex, endIndex - weapon.WeaponIndex+1);
                    if (weapon.CurrentDurability != 100 && weapon.MaxDurability != -1 && weapon.MaxDurability != 100 && weapon.CurrentDurability != 0 && weapon.MaxDurability != 0)
                    {
                        weaponList.Add(weapon);
                    }
                    else
                    {
                        continue;
                    }
                }
            }

            return weaponList;
        }
        /// <summary>
        /// Saveing Equipment
        /// </summary>
        /// <param name="weapon">Written Equipment</param>
        public void WriteWeaponByte(WeaponMemoryInfo weapon)
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

            br.DeleteIntsByStartAndEnd(weapon.WeaponIndex, weapon.NextWeaponIndex - 1);
            br.AddByIndex(weapon.WeaponIndex, weapon.WeaponBytes);
        }
        /// <summary>
        /// Check if equipment is Equipable
        /// </summary>
        /// <param name="weapon">Equipment Object</param>
        /// <returns></returns>
        public bool IsWeapon(WeaponMemoryInfo 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.WeaponIndex+4, 17);
            }
            catch
            {
                return false;
            }
        }
        /// <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(WeaponMemoryInfo weaponInfo, List<AttributeInfo> attInfoList)
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

            List<AttributeMemoryInfo> attList = weaponInfo.WeaponAttList;
            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;
        }
        /// <summary>
        /// Get all Equipment
        /// </summary>
        /// <returns></returns>
        public List <WeaponMemoryInfo> GetAllWeapon()
        {
            if (br.BtList == null)
            {
                throw new Exception("save-file not open");
            }

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

            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;
                    }
                }

                WeaponMemoryInfo weapon = new WeaponMemoryInfo();
                weapon.WeaponIndex = indexList[i];
                if (i != indexList.Count - 1)
                {
                    weapon.NextWeaponIndex = indexList[i + 1];
                    weapon.WeaponBytes     = br.GetBytsByIndexAndLength(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.WeaponIndex + AmalurSaveEditer.WeaponAttHeadOffSet;
                    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.WeaponBytes = br.GetBytsByIndexAndLength(weapon.WeaponIndex, endIndex - weapon.WeaponIndex + 1);
                    if (weapon.CurrentDurability != 100 && weapon.MaxDurability != -1 && weapon.MaxDurability != 100 && weapon.CurrentDurability != 0 && weapon.MaxDurability != 0)
                    {
                        weaponList.Add(weapon);
                    }
                    else
                    {
                        continue;
                    }
                }
            }

            return(weaponList);
        }