public void addAttribute(string id, string type, object value)
 {
     if (id != null && type != null && value != null)
     {
         ItemAttribute ia = new ItemAttribute(id, type, value);
         Attributes.Add(ia);
     }
 }
Esempio n. 2
0
 void addAttribute()
 {
     EditorUtility.SetDirty(itemAttributeList);
     ItemAttribute newAttribute = new ItemAttribute();
     newAttribute.attributeName = addAttributeName;
     itemAttributeList.itemAttributeList.Add(newAttribute);
     addAttributeName = "";
     EditorUtility.SetDirty(itemAttributeList);
 }
Esempio n. 3
0
    void addAttribute()
    {
        EditorUtility.SetDirty(itemAttributeList);
        ItemAttribute newAttribute = new ItemAttribute();

        newAttribute.attributeName = addAttributeName;
        itemAttributeList.itemAttributeList.Add(newAttribute);
        addAttributeName = "";
        EditorUtility.SetDirty(itemAttributeList);
    }
        private static List <ParserStat> ParseIntValues(ItemAttribute attribute, XmlNode node)
        {
            List <ParserStat> values = new List <ParserStat>();

            for (int i = 2; i <= 17; i++)
            {
                values.Add(new ParserStat(attribute, int.Parse(node.Attributes[$"idx{i}"].Value)));
            }
            return(values);
        }
Esempio n. 5
0
        /// <summary>
        /// Creates <see cref="ItemAttribute"/> element.
        /// </summary>
        /// <param name="name">Name field value for ItemAttribute.</param>
        /// <param name="friendlyname">FriendlyName field value for ItemAttribute.</param>
        /// <param name="type">Type field value for ItemAttribute.</param>
        /// <param name="val">Value field value for ItemAttribute.</param>
        /// <returns>Returns new <see cref="ItemAttribute"/> element.</returns>
        public static ItemAttribute CreateAttribute(string name, string friendlyname, string type, string[] val)
        {
            ItemAttribute attr = new ItemAttribute();

            attr.FriendlyName = friendlyname;
            attr.Name         = name;
            attr.Type         = type;
            attr.Value        = val;
            return(attr);
        }
Esempio n. 6
0
        public async Task <ActionResult> Create(ItemAttribute itemAttribute)
        {
            if (!ModelState.IsValid)
            {
                return(View(itemAttribute));
            }
            _db.ItemAttributes.Add(itemAttribute);
            await _db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 7
0
        public async Task GetItemAttributeResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            ItemAttribute itemAttribute = await client.GetResourceAsync <ItemAttribute>(1);

            // assert
            Assert.True(itemAttribute.Id != default(int));
        }
Esempio n. 8
0
        public async Task <ActionResult> Edit(ItemAttribute itemAttribute)
        {
            if (!ModelState.IsValid)
            {
                return(View(itemAttribute));
            }
            _db.Entry(itemAttribute).State = EntityState.Modified;
            await _db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IHttpActionResult> GetItemAttribute(Guid id)
        {
            ItemAttribute itemAttribute = await db.ItemAttributes.FindAsync(id);

            if (itemAttribute == null)
            {
                return(NotFound());
            }

            return(Ok(itemAttribute));
        }
        public ActionResult Edit(ItemAttribute itemattribute)
        {
            if (ModelState.IsValid)
            {
                var dbItemAttributes = db.ItemAttributes.FirstOrDefault(p => p.ItemAttribute_Id == itemattribute.ItemAttribute_Id);
                if (dbItemAttributes == null)
                {
                    return(HttpNotFound());
                }
                //dbItemAttributes.AttributeLookup_Id = itemattribute.AttributeLookup_Id;
                dbItemAttributes.ActualAttributeValue = itemattribute.ActualAttributeValue;
                int usertypeid = int.Parse(Session.Contents["UserTypeId"].ToString());
                dbItemAttributes.ModifiedBy   = usertypeid;
                dbItemAttributes.ModifiedDate = DateTime.Now;
                var PrintedDate = itemattribute.PrintedDate;
                if (PrintedDate != null)
                {
                    if (DateTime.Now > PrintedDate)
                    {
                        dbItemAttributes.PrintedDate = null;
                    }
                }


                if (itemattribute.AttributeLookup_Id == 0 || itemattribute.AttributeLookup_Id == null)
                {
                    int atid = int.Parse(Request.Form["hdnAttributeTypeId"]);

                    int alid = db.Attribute_Lookup.Where(al => (al.AttributeType_Id == atid) && (al.WebsiteAttributeValue == "Not Selected")).Select(al => al.AttributeLookup_Id).Single();
                    itemattribute.AttributeLookup_Id    = alid;
                    dbItemAttributes.AttributeLookup_Id = itemattribute.AttributeLookup_Id;
                }
                else
                {
                    dbItemAttributes.AttributeLookup_Id = itemattribute.AttributeLookup_Id;
                }
                db.SaveChanges();
                int item_id = itemattribute.Item_Id.Value;//db.ItemAttributes.Where(ia => ia.ItemAttribute_Id == id).Select(ia => ia.Item_Id).Single();
                ViewBag.Itm_num           = db.Items.Where(i => i.Item_id == item_id).Select(i => i.Itm_Num).Single();
                ViewBag.ItemDescription   = db.Items.Where(i => i.Item_id == item_id).Select(i => i.Item_Description).Single();
                ViewBag.SFItemDescription = db.Items.Where(i => i.Item_id == item_id).Select(i => i.SF_Item_Description).Single();

                GetCategoryClass(item_id);
                if (ViewBag.CategoryClass == "Y")
                {
                    GetItemDescription(item_id);
                }

                return(RedirectToAction("Index", new { id = itemattribute.Item_Id }));
            }
            return(View(itemattribute));
        }
Esempio n. 11
0
        public async Task <bool> AddItemAttribute(ItemAttribute itemAttribute)
        {
            using (var db = new LoetopiaContext())
            {
                db.ItemAttributes.Add(itemAttribute);
                if (await db.SaveChangesAsync() > 0)
                {
                    return(true);
                }

                return(false);
            }
        }
Esempio n. 12
0
        public async Task <IHttpActionResult> DeleteItemAttribute(Guid id)
        {
            ItemAttribute itemAttribute = await db.ItemAttributes.FindAsync(id);

            if (itemAttribute == null)
            {
                return(NotFound());
            }
            db.ItemAttributes.Remove(itemAttribute);
            await db.SaveChangesAsync();

            return(Ok());
        }
Esempio n. 13
0
        public T GetAttributeValue <T>(string key, T orDefault)
        {
            ItemAttribute attrib = GetAttribute(key);

            if (attrib != null)
            {
                if ((typeof(T).Equals(attrib.Value.GetType())))
                {
                    return((T)attrib.Value);
                }
            }
            return(orDefault);
        }
Esempio n. 14
0
    public static ItemAttribute CreateItemStackAttrib()
    {
        ItemAttribute item = ScriptableObject.CreateInstance <StackableAttribute>();

        AssetDatabase.CreateAsset(item, "Assets/Inventory/stackAttrib.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = item;

        return(item);
    }
Esempio n. 15
0
    public bool GetBoolAttribute(string name)
    {
        ItemAttribute attribute = GetAttributeByName(name);

        if (attribute != null)
        {
            return(Convert.ToBoolean(attribute.Value.ToString()));
        }
        else
        {
            return(false);
        }
    }
Esempio n. 16
0
    public float GetFloatAttribute(string name)
    {
        ItemAttribute attribute = GetAttributeByName(name);

        if (attribute != null)
        {
            return(Convert.ToSingle(attribute.Value.ToString()));
        }
        else
        {
            return(0);
        }
    }
Esempio n. 17
0
    public string GetStringAttribute(string name)
    {
        ItemAttribute attribute = GetAttributeByName(name);

        if (attribute != null)
        {
            return(attribute.Value.ToString());
        }
        else
        {
            return("");
        }
    }
Esempio n. 18
0
    public int GetIntAttribute(string name)
    {
        ItemAttribute attribute = GetAttributeByName(name);

        if (attribute != null)
        {
            return(Convert.ToInt32(attribute.Value.ToString()));
        }
        else
        {
            return(0);
        }
    }
 public static ItemAttribute GearTypeCombine(ItemAttribute baseItem, ItemAttribute addonItem)
 {
     Dictionary<ItemAttribute, ItemAttribute> gearDictionary = null;
     ItemAttribute newGearType;
     if (ItemAttributeContainer.TryGetValue(baseItem, out gearDictionary))
     {
         if (gearDictionary.TryGetValue(addonItem, out newGearType))
         {
             return newGearType;
         }
     }
     return ItemAttribute.NOTYPE;
 }
Esempio n. 20
0
        /// <summary>
        /// Add or update variation of this item
        /// </summary>
        /// <param name="currItem">the item </param>
        /// <param name="prodAttrib">the attribute</param>
        /// <returns>Item modified with new data</returns>
        async Task <Item> AddOrUpdateVarieties(Item currItem, ProductAttributeLine prodAttrib, WooProductAttributeMap currWooProductAttributeMap) //, bool IsAttributeVarietyUpddate)
        {
            IAppRepository <ItemAttributeVarietyLookup> _itemAttribVarietyLookupRepo = _AppUnitOfWork.Repository <ItemAttributeVarietyLookup>();
            ItemAttributeVarietyLookup _itemAttributeVarietyLookup = null;

            foreach (var attrbiTerm in prodAttrib.options)
            {
                _itemAttributeVarietyLookup = await _itemAttribVarietyLookupRepo.FindFirstAsync(ItemAttributeVariety => ItemAttributeVariety.VarietyName == attrbiTerm);

                if (_itemAttributeVarietyLookup != null)
                {
                    // found so update or add
                    ItemAttribute _itemAttribute = currItem.ItemAttributes.Find(ic => ic.ItemAttributeLookupId == currWooProductAttributeMap.ItemAttributeLookupId);
                    if (_itemAttribute == null)
                    {
                        return(currItem); // this should never occur
                    }
                    // does this attribute have this variety, if so update otherwise add
                    if ((_itemAttribute.ItemAttributeVarieties != null) && (_itemAttribute.ItemAttributeVarieties.Exists(iav => iav.ItemAttributeVarietyLookupId == _itemAttributeVarietyLookup.ItemAttributeVarietyLookupId)))
                    {
                        // this attribute variety / term exists so just update it. Do stuff here if we need - so far nada
                        //make sure this matches
                        ItemAttributeVariety _itemAttributeVariety = _itemAttribute.ItemAttributeVarieties.FirstOrDefault(iav => iav.ItemAttributeVarietyLookupId == _itemAttributeVarietyLookup.ItemAttributeVarietyLookupId);
                        ///-> can this be null? It should never be
                        // copy the whole item across just in case there have been changes
                        _itemAttributeVariety.ItemAttributeVarietyLookupDetail = _itemAttributeVarietyLookup;
                        _itemAttributeVariety.ItemAttributeId = _itemAttribute.ItemAttributeId;
                    }
                    else
                    {
                        // we have a attribute variety, this means we should have an attribute that, that belongs too.

                        if (_itemAttribute.ItemAttributeVarieties == null)
                        {
                            _itemAttribute.ItemAttributeVarieties = new List <ItemAttributeVariety>();
                        }
                        // create a new variety assume 1.0 as in 1-1 QTY and update the ItemDetails. Do not change Item Id as then EF core knows it is a new record.
                        _itemAttribute.ItemAttributeVarieties.Add(new ItemAttributeVariety
                        {
                            ItemAttributeVarietyLookupId     = _itemAttributeVarietyLookup.ItemAttributeVarietyLookupId,
                            ItemAttributeVarietyLookupDetail = _itemAttributeVarietyLookup,    // copy the whole attribute across
                            ItemAttributeId = _itemAttribute.ItemAttributeId,
                            UoMId           = _itemAttributeVarietyLookup.UoMId,
                            UoM             = _itemAttributeVarietyLookup.UoM,
                            UoMQtyPerItem   = 1.0
                        });
                    }
                }
            }
            return(currItem);
        }
Esempio n. 21
0
    private List <ItemAttribute> ParseAttributes(string blob)
    {
        string []            lines      = blob.Split('\n');
        List <ItemAttribute> attributes = new List <ItemAttribute>();

        foreach (string line in lines)
        {
            if (line.Length <= 3)
            {
                continue;
            }

            string [] tokens = line.Split('=');
            if (tokens.Length < 2)
            {
                continue;
            }

            object        value     = null;
            ItemAttribute attribute = null;
            if (tokens[1][0] == '"')
            {
                //we have a string
                attribute = new ItemAttribute(tokens[0], tokens[1].Substring(1, tokens[1].Length - 2));
            }
            else if (tokens[1][0] == '#')
            {
                //bool
                string boolValue = tokens[1].Substring(1);
                attribute = new ItemAttribute(tokens[0], Convert.ToBoolean(boolValue));
            }
            else if (tokens[1][0] == 'd')
            {
                //int
                string intValue = tokens[1].Substring(1);
                attribute = new ItemAttribute(tokens[0], Convert.ToInt32(intValue));
            }
            else
            {
                //float
                attribute = new ItemAttribute(tokens[0], Convert.ToSingle(tokens[1]));
            }

            if (attribute != null)
            {
                attributes.Add(attribute);
            }
        }

        return(attributes);
    }
Esempio n. 22
0
        public async Task <IActionResult> CreateItemAttribute([FromBody] ItemAttributeDTO itemAttribute)
        {
            //Using System.Text.Json
            //var result = JsonSerializer.Deserialize<ItemAttribute>(itemAttribute);
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (itemAttribute == null)
            {
                return(BadRequest("No value please check"));
            }
            var isitemAttributeExists = _unitOfWork.ItemAttributes.CheckItemAttribute(itemAttribute);

            if (isitemAttributeExists > 0)
            {
                return(BadRequest("validation error!"));
            }
            else
            {
                var itemAttributeToADD = new ItemAttribute
                {
                    ItemSize        = itemAttribute.ItemSize,
                    InCityRate      = itemAttribute.InCityRate,
                    OutCityRate     = itemAttribute.OutCityRate,
                    RegularRate     = itemAttribute.RegularRate,
                    ConditionCharge = itemAttribute.ConditionCharge,
                    BookingCharge   = itemAttribute.BookingCharge,
                    ItemId          = itemAttribute.ItemId
                };
                if (itemAttribute.MerchantId != null)
                {
                    var merchant = await _unitOfWork.Merchants.GetMerchantDetailsAsync(itemAttribute.MerchantId);

                    if (merchant == null)
                    {
                        return(BadRequest("Invalid merchant"));
                    }
                    itemAttributeToADD.MerchantIdentity = merchant.MerchantIdentity;
                }

                await _unitOfWork.ItemAttributes.AddItem(itemAttributeToADD);
            }
            var result = await _unitOfWork.CompleteAsync();

            if (result == 0)
            {
                return(BadRequest("dont save"));
            }
            return(Ok());
        }
        protected override void OnContentChanged()
        {
            base.OnContentChanged();

            if (engineTypes == null)
            {
                engineTypes = ApplicationManager.Manager.GetTypes(typeof(IEngine)).
                              OrderBy(x => {
                    string name = ItemAttribute.GetName(x);
                    if (name != null)
                    {
                        return(name);
                    }
                    else
                    {
                        return(x.GetPrettyName());
                    }
                }).ToList();
                foreach (Type t in engineTypes)
                {
                    string name = ItemAttribute.GetName(t);
                    if (name == null)
                    {
                        name = t.GetPrettyName();
                    }
                    engineComboBox.Items.Add(name);
                }
            }

            if (Content == null)
            {
                engineViewHost.Content        = null;
                operatorGraphViewHost.Content = null;
            }
            else
            {
                if (Content.Engine == null)
                {
                    engineComboBox.SelectedIndex = -1;
                }
                else
                {
                    engineComboBox.SelectedIndex = engineTypes.IndexOf(Content.Engine.GetType());
                }
                engineViewHost.ViewType        = null;
                engineViewHost.Content         = Content.Engine;
                operatorGraphViewHost.ViewType = null;
                operatorGraphViewHost.Content  = Content.OperatorGraph;
            }
        }
        public static ItemAttribute operator -(ItemAttribute item1, ItemAttribute item2)
        {
            ItemAttribute itemAttribute = new ItemAttribute
            {
                Damage   = item1.Damage - item2.Damage,
                Defence  = item1.Defence - item2.Defence,
                Strength = item1.Strength - item2.Strength,
                Intel    = item1.Intel - item2.Intel,
                Agility  = item1.Agility - item2.Agility
            };

            itemAttribute.CalculateCompositeAttribute();
            return(itemAttribute);
        }
Esempio n. 25
0
    public static List <ItemAttribute> CopyAsNew(this List <ItemAttribute> copy)
    {
        var target = new List <ItemAttribute>();

        if (copy != null)
        {
            for (int i = 0; i < copy.Count; i++)
            {
                ItemAttribute attribute = new ItemAttribute(copy[i].name, copy[i].value);
                target.Add(attribute);
            }
        }
        return(target);
    }
Esempio n. 26
0
        public static bool HasIngredient(this Item item, Type ingredienttype, HashSet <Item> checkeditems = null, bool allergyfix = true) //stays in core as it can also be used for othere things other than allergies, also the AllergyIgnoreAttribute exists in core so theres no problem
        {
            if (checkeditems == null)
            {
                checkeditems = new HashSet <Item>();
            }
            if (checkeditems.Contains(item))
            {
                return(false);
            }
            checkeditems.Add(item);
            //Console.WriteLine(checkeditems.Count);
            if (allergyfix && ItemAttribute.Has <AllergyIgnoreAttribute>(item.Type))
            {
                return(false);
            }


            if (item.Type == ingredienttype)
            {
                return(true);
            }
            IEnumerable <Recipe> recipes = Recipe.GetRecipesForItem(item.Type);

            recipes = recipes.Where(y =>
            {
                IEnumerable <CraftingElement> recipeingredients = y.Ingredients.Where(z =>
                {
                    return(z.Item.HasIngredient(ingredienttype, checkeditems, allergyfix));
                });
                if (recipeingredients.Count() != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            });
            if (recipes.Count() != 0)
            {
                //recipes.ForEach(x => ChatManager.ServerMessageToAllAlreadyLocalized(x.FriendlyName, false));
                return(true);
            }
            else
            {
                return(false);
            }
        }
    public ItemDefinition(ItemDefinition_SO item_SO)
    {
        itemID = item_SO.itemID;

        if (item_SO.itemType == ItemType.Equipment)
        {
            EquipmentDefinition_SO equipment_SO = (EquipmentDefinition_SO)item_SO;

            attributes = new ItemAttribute[equipment_SO.attributes.Length];
            for (int i = 0; i < equipment_SO.attributes.Length; i++)
            {
                attributes[i] = new ItemAttribute(equipment_SO.attributes[i].attributeType, equipment_SO.attributes[i].minValue, equipment_SO.attributes[i].maxValue);
            }
        }
    }
Esempio n. 28
0
        public async Task <IHttpActionResult> PostItemAttribute(ItemAttribute itemAttribute)
        {
            Entities.Attribute attribute = db.Attributes.FirstOrDefault(x => x.Value == itemAttribute.Target.Value && x.Code == itemAttribute.Target.Code);

            if (attribute != null)
            {
                itemAttribute.Target   = null;
                itemAttribute.TargetId = attribute.Id;
            }
            db.ItemAttributes.Add(itemAttribute);
            await db.SaveChangesAsync();

            await db.Entry(itemAttribute).GetDatabaseValuesAsync();

            return(Ok(itemAttribute));
        }
Esempio n. 29
0
        private static void AddHiddenNormalStat(List <NormalStat> normalStats, ItemAttribute attribute, int value, float calibrationFactor)
        {
            NormalStat normalStat = normalStats.FirstOrDefault(x => x.ItemAttribute == attribute);

            if (normalStat == null)
            {
                return;
            }
            int calibratedValue = (int)(value * calibrationFactor);

            Random random     = new Random();
            int    index      = normalStats.FindIndex(x => x.ItemAttribute == attribute);
            int    summedFlat = normalStat.Flat + random.Next(value, calibratedValue);

            normalStats[index] = new NormalStat(normalStat.ItemAttribute, summedFlat, normalStat.Percent);
        }
Esempio n. 30
0
        public static void RemoveSerialNumberFromDescription(ref Item _item, out string sItemPrefix, out string sDescriptionLabel)
        {
            List <ItemAttribute> itemAttribs            = _item.Attributes;
            ItemAttribute        itemAttribSerialNumber = itemAttribs.Find(
                ia => ia.Description == "Serial Number");
            int iSerialNumberIdx = itemAttribs.FindIndex(a => a.MdseField == 'S');

            if (iSerialNumberIdx >= 0)
            {
                itemAttribSerialNumber.Answer.AnswerText = "";
                itemAttribs.RemoveAt(iSerialNumberIdx);
                itemAttribs.Insert(iSerialNumberIdx, itemAttribSerialNumber);
            }
            _item.Attributes = itemAttribs;

            GenerateTicketDescription(ref _item, out sItemPrefix, out sDescriptionLabel);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ItemAttribute itemattribute = db.ItemAttributes.Find(id);
            int           item_id       = itemattribute.Item_Id.Value;

            db.ItemAttributes.Remove(itemattribute);
            db.SaveChanges();

            GetCategoryClass(item_id);
            if (ViewBag.CategoryClass == "Y")
            {
                GetItemDescription(item_id);
            }


            return(RedirectToAction("Index", new { id = item_id }));
        }
Esempio n. 32
0
        private static void AddHiddenNormalStat(List <NormalStat> normalStats, ItemAttribute attribute, int value, float calibrationFactor)
        {
            NormalStat normalStat = normalStats.FirstOrDefault(x => x.ItemAttribute == attribute);

            if (normalStat == null)
            {
                return;
            }
            int calibratedValue = (int)(value * calibrationFactor);

            int index        = normalStats.FindIndex(x => x.ItemAttribute == attribute);
            int biggerValue  = Math.Max(value, calibratedValue);
            int smallerValue = Math.Min(value, calibratedValue);
            int summedFlat   = normalStat.Flat + RandomProvider.Get().Next(smallerValue, biggerValue);

            normalStats[index] = new NormalStat(normalStat.ItemAttribute, summedFlat, normalStat.Percent);
        }
Esempio n. 33
0
    private bool TryDamageBranch(INetObject damager, float amount, InteractionContext context)
    {
        int        branchID = context.Parameters["branch"];
        TreeBranch branch   = this.branches[branchID];

        if (context.Parameters.ContainsKey("leaf"))
        {
            int leafID = context.Parameters["leaf"];

            // damage leaf
            LeafBunch leaf = branch.Leaves[leafID];

            if (leaf.Health > 0)
            {
                leaf.Health = Mathf.Max(0, leaf.Health - amount);

                if (leaf.Health <= 0)
                {
                    leaf.Health = 0;

                    if (RandomUtil.Value < this.Species.SeedDropChance)
                    {
                        var    numSeeds      = (int)this.Species.SeedRange.Max;
                        int    numBonusSeeds = 0;
                        Item[] newSeeds      = new Item[] { };
                        if (numSeeds > 0 && this.Species.SeedItem != null)
                        {
                            var yield = ItemAttribute.Get <YieldAttribute>(this.Species.SeedItem.Type);
                            numBonusSeeds = yield != null?yield.Yield.GetCurrentValueInt(context.Player.User) : 0;

                            context.Player.User.Inventory.TryAddItems(this.Species.SeedItem.Type, numSeeds + numBonusSeeds);
                        }
                    }
                    this.RPC("DestroyLeaves", branchID, leafID);
                }
            }

            this.Save();
            return(true);
        }
        else
        {
            return(this.TryDamageBranch(branch, branchID, amount));
        }
    }
Esempio n. 34
0
	public Item(Item item)
	{
		//clone an existing item
		ID = item.ID;
		Name = item.Name;
		Description = item.Description;
		Weight = item.Weight;
		SpriteName = item.SpriteName;
		PrefabName = item.PrefabName;
		Type = item.Type;
		GridCols = item.GridCols;
		GridRows = item.GridRows;
		MaxStackSize = item.MaxStackSize;
		Attributes = new List<ItemAttribute>();
		foreach(ItemAttribute attribute in item.Attributes)
		{
			ItemAttribute newAttribute = new ItemAttribute(attribute.Name, attribute.Value);
			Attributes.Add(newAttribute);
		}

		AttributeIndex = new Dictionary<string, int>();
		BuildIndex();
	}
    public void GetFilter(SearchQuery q)
    {
        foreach (GridViewRow row in gv1.Rows)
        {
            AttributeUc auc1 = InitAttributeUc(row.Cells[0]);

            ItemAttribute ia = new ItemAttribute(Cxt, Uc.ItemID, auc1.AttributeID);

            auc1.GetFilter(q, ia);
        }
    }
    protected void btnDelete_Command(object sender, CommandEventArgs e)
    {
        ItemAttribute ia = new ItemAttribute(Cxt, Uc.Item.ID, Convert.ToInt32(e.CommandArgument));

        ia.Delete();

        InitControl();
    }
 public virtual void GetFilter(SearchQuery q, ItemAttribute ia)
 {
     RsCtrl.GetFilter(q, ia);
 }
 public void addAttribute(ItemAttribute ia)
 {
     if (ia != null) {
         Attributes.Add(ia);
     }
 }
Esempio n. 39
0
        public static void WriteDefaultValues()
        {
            SSEHeader header = new SSEHeader();
            ItemData dataHeader = new ItemData();

            header.FileHeader = "SSEItem";
            header.ItemCount = 4;

            List<ItemAttribute> attribsWeapon1 = new List<ItemAttribute>();

            ItemAttribute attribWeapon1 = new ItemAttribute();

            attribWeapon1.Id = 6;
            attribWeapon1.ValueByte = 266.0f;

            attribsWeapon1.Add(attribWeapon1);

            attribWeapon1 = new ItemAttribute();

            attribWeapon1.Id = 80;
            attribWeapon1.ValueByte = 0;

            attribsWeapon1.Add(attribWeapon1);

            attribWeapon1 = new ItemAttribute();

            attribWeapon1.Id = 81;
            attribWeapon1.ValueByte = 0;

            attribsWeapon1.Add(attribWeapon1);

            List<ItemAttribute> attribsWeapon2 = new List<ItemAttribute>();

            ItemAttribute attribWeapon2 = new ItemAttribute();

            attribWeapon2.Id = 6;
            attribWeapon2.ValueByte = BitConverter.ToSingle(new byte[] { 0x00, 0x00, 0x16, 0x42 }, 0);

            attribsWeapon2.Add(attribWeapon2);

            attribWeapon2 = new ItemAttribute();

            attribWeapon2.Id = 80;
            attribWeapon2.ValueByte = 0;

            attribsWeapon2.Add(attribWeapon2);

            attribWeapon2 = new ItemAttribute();

            attribWeapon2.Id = 82;
            attribWeapon2.ValueByte = 0;

            attribsWeapon2.Add(attribWeapon2);

            List<ItemAttribute> attribsMusic = new List<ItemAttribute>();

            ItemAttribute attribMusic = new ItemAttribute();

            attribMusic.Id = 113;
            attribMusic.ValueByte = 5;

            attribsMusic.Add(attribMusic);

            List<ItemAttribute> attribsSticker = new List<ItemAttribute>();

            ItemAttribute attribSticker = new ItemAttribute();

            attribSticker.Id = 166;
            attribSticker.ValueByte = 3;

            attribsSticker.Add(attribSticker);

            using (Stream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
            {
                // id, inventory, quality, rarity, level, def_index, {attrs}
                Write(stream, header);
                // weapons 0 0 4 2 1 4 6=00008543 80=00000000 81=00000000
                CreateItem(4, 4, 2, 1, attribsWeapon1, stream, dataHeader);

                // weapon 0 0 4 2 1 16 6=00001642 80=00000000 81=00000000
                CreateItem(16, 4, 2, 1, attribsWeapon2, stream, dataHeader);

                // sticker 0 0 0 0 0 1209 113=02000000
                CreateItem(1209, 0, 0, 0, attribsMusic, stream, dataHeader);

                // music kit 0 0 0 0 0 1314 166=03000000
                CreateItem(1314, 0, 0, 0, attribsSticker, stream, dataHeader);
            }
        }
Esempio n. 40
0
 public void LoadObject(StreamReader inStream)
 {
     this.itemCategory = (ItemCategory)Enum.Parse(typeof(ItemCategory), inStream.ReadLine());
     this.itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), inStream.ReadLine());
     this.itemState = (ItemState)Enum.Parse(typeof(ItemState), inStream.ReadLine());
     this.x = Int32.Parse(inStream.ReadLine());
     this.y = Int32.Parse(inStream.ReadLine());
     this.ID = inStream.ReadLine();
     this.maxStackSize = Int32.Parse(inStream.ReadLine());
     this.stackSize = Int32.Parse(inStream.ReadLine());
     this.worth = Double.Parse(inStream.ReadLine());
     attributes = new List<ItemAttribute>();
     int attributeSize = Int32.Parse(inStream.ReadLine());
     for (int i = 0; i < attributeSize; i++)
     {
         ItemAttribute newIA = new ItemAttribute();
         newIA.type = (ItemAttributeType)Enum.Parse(typeof(ItemAttributeType), inStream.ReadLine());
         newIA.parameter = inStream.ReadLine();
         attributes.Add(newIA);
     }
 }