/// <summary>
        /// 附魔
        /// </summary>
        public static bool ItemEnchant(this MainForm main, Item item, EnchantInfo attribute)
        {
            if (attribute == null || item == null)
            {
                return(false);
            }
            ItemClassInfo info = main.DataHelper.getItemClassInfo(item.ItemClass);

            if (info != null)
            {
                if (!(info.MainCategory == MainCategory.WEAPON ||
                      info.SubCategory == SubCategory.INNERARMOR ||
                      info.MainCategory == MainCategory.CLOTH ||
                      info.MainCategory == MainCategory.LIGHTARMOR ||
                      info.MainCategory == MainCategory.HEAVYARMOR ||
                      info.MainCategory == MainCategory.PLATEARMOR ||
                      info.MainCategory == MainCategory.ACCESSORY))
                {
                    if (!main.Question("该类型[" + info.MainCategory.Name() + "]不适合附魔,确定强制附魔?"))
                    {
                        return(false);
                    }
                }
            }

            ItemAttributeType type = attribute.IsPrefix ? ItemAttributeType.PREFIX : ItemAttributeType.SUFFIX;

            return(ModItemAttr(main, new ItemAttribute(type, attribute.Class).SetArg(attribute.MaxArg), item));
        }
        /// <summary>
        /// 附魔
        /// </summary>
        public static bool ItemEnchant(this MainForm main, Item item, EnchantInfo attribute)
        {
            if (attribute == null || item == null)
            {
                return(false);
            }
            ItemClassInfo info = main.DataHelper.GetItemInfo(item.ItemClass);

            if (info != null)
            {
                if (!(info.MainCategory == MainCategory.WEAPON ||
                      info.SubCategory == SubCategory.INNERARMOR ||
                      info.MainCategory == MainCategory.CLOTH ||
                      info.MainCategory == MainCategory.LIGHTARMOR ||
                      info.MainCategory == MainCategory.HEAVYARMOR ||
                      info.MainCategory == MainCategory.PLATEARMOR ||
                      info.MainCategory == MainCategory.ACCESSORY))
                {
                    if (!main.Question("该类型[" + info.MainCategory.Name() + "]不适合附魔,确定强制附魔?"))
                    {
                        return(false);
                    }
                }
            }

            ItemAttributeType type = attribute.IsPrefix ? ItemAttributeType.PREFIX : ItemAttributeType.SUFFIX;

            return(ModItemAttr(main, new ItemAttribute(type, attribute.Class).SetArg(attribute.MaxArg), item));
//
//			if (db.ExcuteScalarSQL("SELECT COUNT(*) FROM ItemAttribute ia LEFT JOIN Item i ON i.ID = ia.ItemID"
//			                       + " WHERE (ia.Attribute = '" + name + "') AND i.ID =" + item.ItemID) == 0)
//			{
//				return db.ExcuteSQL(string.Concat(new object[] {
//				                                    "INSERT INTO ItemAttribute ([ItemID], [Attribute], [Value], [Arg], [Arg2]) VALUES (",
//				                                    item.ItemID, ", '"+name+"','", attribute.Class, "', '"+attribute.MaxArg+"', '0')" })) > 0;
//			}
//			else if (db.ExcuteSQL("UPDATE ItemAttribute SET [Value] ='"+ attribute.Class+ "',[Arg]='"+ attribute.MaxArg +
//			                      "' WHERE ItemID =" + item.ItemID+ " AND Attribute = '"+name+"'") > 0)
//			{
//				return true;
//			}
//			return false;
        }
        public ActionResult SaveItemAttribute(ItemAttributeType atp)
        {
            string att = RoundOff(atp.ItemAttribute);
            var    dta = db.ItemAttributeTypes.Where(m => m.ItemAttribute == att).ToList();

            if (dta.Count != 0)
            {
                return(Content("itmatt"));
            }
            else
            {
                atp.ActiveAttribute = false;
                atp.CreatedBy       = (Session["HAname"]).ToString();
                atp.CreatedOn       = DateTime.Now;
                db.ItemAttributeTypes.Add(atp);
                db.SaveChanges();

                return(Content(""));
            }
        }
 public ItemAttribute(ItemAttributeType attributeType, int value)
 {
     AttributeType = attributeType;
     Value         = value;
 }
Exemple #5
0
 public ItemAttribute(ItemAttributeType type, int arg)
 {
     this.Type = type;
     this.Arg  = arg;
 }
Exemple #6
0
 public ItemAttribute(ItemAttributeType type, string val)
 {
     this.Type  = type;
     this.Value = val;
 }