Пример #1
0
        // Allows cooking a custom item.
        public static Item Cook(Player player, string name)
        {
            int       hash       = StringHashHelper.HashItemName(name);
            ItemTable definition = Items[hash];

            return(CookFromDefinition(player, definition));
        }
Пример #2
0
        public IHttpActionResult PostItemTable(ItemTable itemTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ItemTables.Add(itemTable);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ItemTableExists(itemTable.ItemID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = itemTable.ItemID }, itemTable));
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AtomFeed"/> class.
        /// Reads an atom feed based on the xml given in channel
        /// </summary>
        /// <param name="feedXml">the entire feed xml as string</param>
        /// <param name="feed">the feed element in the xml as XElement</param>
        public AtomFeed(string feedXml, XElement feed)
            : base(feedXml, feed)
        {
            Link = feed.GetElement("link").Attribute("href")?.Value;
            var categories = feed.GetElements("category");

            Categories       = categories.Select(x => x.GetValue()).ToList();
            Generator        = feed.GetValue("generator");
            Icon             = feed.GetValue("icon");
            Id               = feed.GetValue("id");
            Logo             = feed.GetValue("logo");
            Rights           = feed.GetValue("rights");
            Subtitle         = feed.GetValue("subtitle");
            UpdateDateString = feed.GetValue("updated");
            UpdateDate       = StringParser.TryParseDateTime(UpdateDateString);

            var items = feed.GetElements("entry");

            foreach (var item in items)
            {
                var feedItem = new AtomFeedItem(item);
                if (!ItemTable.ContainsKey(feedItem.HashCode))
                {
                    ItemTable.Add(feedItem.HashCode, feedItem);
                }
                //this.FeedItemList.Add(new AtomFeedItem(item));
            }
        }
Пример #4
0
        private void btnItemTable_Click(object sender, EventArgs e)
        {
            ItemTable frm = new ItemTable();

            frm.SetID(m_strID);
            frm.Show(this);
        }
Пример #5
0
        protected internal override void use(L2Player admin, string alias)
        {
            //summon3 [id] [id2] -- призывает предметы от [id] до [id2]

            int idmin = int.Parse(alias.Split(' ')[1]);
            int idmax = int.Parse(alias.Split(' ')[2]);

            if (idmax - idmin > 200)
            {
                admin.sendMessage("Too big id range.");
                return;
            }

            bool x = false;

            for (int i = idmin; i <= idmax; i++)
            {
                ItemTemplate item = ItemTable.getInstance().getItem(i);

                if (item == null)
                {
                    admin.sendMessage("Item with id " + i + " not exists.");
                }
                else
                {
                    admin.Inventory.addItem(i, 1, true, false);
                    x = true;
                }
            }

            if (x)
            {
                admin.sendItemList(true);
            }
        }
Пример #6
0
        public Item(GS.Map.World world, ItemTable definition, IEnumerable <Affix> affixList, string serializedGameAttributeMap)
            : base(world, definition.SNOActor)
        {
            SetInitialValues(definition);
            this.Attributes.FillBySerialized(serializedGameAttributeMap);
            this.AffixList.Clear();
            this.AffixList.AddRange(affixList);

            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            /*
             * Attributes[GameAttribute.Item_Quality_Level] = 1;
             * if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
             *  Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
             * if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
             *  Attributes[GameAttribute.Item_Quality_Level] = 3;
             */
            //Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            //Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);

            /*
             * RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
             * RandomGenerator.Next();
             * if (Item.IsArmor(this.ItemType))
             *  RandomGenerator.Next(); // next value is used but unknown if armor
             * RandomGenerator.ReinitSeed();*/
        }
Пример #7
0
        virtual async public Task BeginFindByGaugePageId(Int64 gaugePageId, Action <ItemTable> sucessCallback, Action <Exception> failureCallback)
        {
            ItemTable results = null;

            await Task.Run(() =>
            {
                try
                {
                    results = new ItemTable();
                    this.CreateTableSchema(results);

                    string query = "SELECT * FROM " + TableName +
                                   " WHERE PageId = " + gaugePageId.ToString();

                    using (var statement = sqlConnection.Prepare(query))
                    {
                        while (statement.Step() == SQLiteResult.ROW)
                        {
                            this.LoadTableRow(statement, results);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Telemetry.TrackException(ex);
                    failureCallback(ex);
                }

                sucessCallback(results);
            });
        }
Пример #8
0
        private void UpdateGridViews()
        {
            DataTable dt  = dbmngr.GetProductInfo(PNaam);
            DataTable dt2 = new DataTable();

            for (int i = 0; i <= dt.Rows.Count; i++)
            {
                dt2.Columns.Add();
            }
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                dt2.Rows.Add();
                dt2.Rows[i][0] = dt.Columns[i].ColumnName;
            }
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    dt2.Rows[i][j + 1] = dt.Rows[j][i];
                }
            }
            ItemTable.DataSource = dt2;
            ItemTable.ShowHeader = false;
            ItemTable.DataBind();

            product        = dbmngr.GetProduct(PNaam);
            TitleProd.Text = product.Naam;

            PricesTable.DataSource = product.Prijzen;
            PricesTable.DataBind();

            ReviewTable.DataSource = product.Reviews;
            ReviewTable.DataBind();
        }
Пример #9
0
        public void notifyStats(L2Player owner)
        {
            if (Template.AbnormalMaskEvent > 0)
            {
                owner.AbnormalBitMaskEvent |= Template.AbnormalMaskEvent;
            }

            if (Template.item_skill != null)
            {
                owner.addSkill(Template.item_skill, false, false);
            }

            if (Template.item_skill_ench4 != null && Enchant >= 4)
            {
                owner.addSkill(Template.item_skill_ench4, false, false);
            }

            if (Template.WeaponType == ItemTemplate.L2ItemWeaponType.bow || Template.WeaponType == ItemTemplate.L2ItemWeaponType.crossbow)
            {
                tryEquipSecondary(owner);
            }

            if (Template.SetItem)
            {
                ItemTable.getInstance().NotifyKeySetItem(owner, this, true);
            }

            if (Template.Type == ItemTemplate.L2ItemType.armor && owner.setKeyItems != null && owner.setKeyItems.Contains(Template.ItemID))
            {
                ItemTable.getInstance().NotifySetItemEquip(owner, this, true);
            }

            owner.addStats(this);
        }
Пример #10
0
 protected ItemContainer(IItemService itemService, IdFactory idFactory, ItemTable itemTable)
 {
     ItemService = itemService;
     _idFactory  = idFactory;
     _itemTable  = itemTable;
     Items       = new List <L2Item>();
 }
Пример #11
0
        public IHttpActionResult PutItemTable(int id, ItemTable itemTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != itemTable.ItemID)
            {
                return(BadRequest());
            }

            db.Entry(itemTable).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #12
0
        /// <summary>
        /// When overridden in the derived class, reads the information for an item.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
        /// <returns>The read item information.</returns>
        protected override IItemTable ReadItemInfo(IValueReader reader)
        {
            var ret = new ItemTable();

            ret.ReadState(reader);
            return(ret);
        }
Пример #13
0
    public void OnEnable()
    {
        // usedIndex = new int[ItemTable.keys[ItemTable.keys.Length-1] + 1];
        itemList  = GetComponent <ItemTable>();
        usedIndex = ItemTable.keys;

        if (!Load())
        {
            foodData     = 0;
            goldData     = 0;
            researchData = 0;
            suppliesData = 0;

            Debug.Log("Size is: " + (ItemTable.keys[ItemTable.keys.Length - 1] + 1));                   //remove later

            // inventory = new int[itemList.Size];
            inventory = new int[ItemTable.keys[ItemTable.keys.Length - 1] + 1];

            // while(inventory.Count < inventory.Capacity){
            //  inventory.Add(0);
            // }
            // usedIndex = ItemTable.keys;

            listData = new HunterList();
        }
    }
Пример #14
0
        UpdateItemAsync(ItemTable objItemTable)
        {
            var ExistingItemTable =
                _context.ItemTable
                .Where(x => x.Id == objItemTable.Id)
                .FirstOrDefault();

            if (ExistingItemTable != null)
            {
                ExistingItemTable.Date =
                    objItemTable.Date;
                ExistingItemTable.ItemName =
                    objItemTable.ItemName;
                ExistingItemTable.ImageUrl =
                    objItemTable.ImageUrl;
                ExistingItemTable.Description =
                    objItemTable.Description;
                ExistingItemTable.Category =
                    objItemTable.Category;
                ExistingItemTable.CategoryId =
                    objItemTable.CategoryId;
                _context.SaveChanges();
            }
            else
            {
                return(Task.FromResult(false));
            }
            return(Task.FromResult(true));
        }
Пример #15
0
 //리스트에서 아이템 제거
 public void Remove(SlotItem item)
 {
     if (ItemTable.Contains(item))
     {
         ItemTable[item.Index] = null;
     }
 }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteMaster.SetAppID(AppID.ItemDistributionManager);
            _fetchList = (state) =>
            {
                var user       = Session[SKeys.User] as User;
                var distroDays = ItemTable.GetDistributionDays(user);

                distroBox.Text      = distroDays.ToString();
                sunCheckbox.Checked = distroDays.IsSunday;
                monCheckbox.Checked = distroDays.IsMonday;
                tueCheckbox.Checked = distroDays.IsTuesday;
                wedCheckbox.Checked = distroDays.IsWednesday;
                thuCheckbox.Checked = distroDays.IsThursday;
                friCheckbox.Checked = distroDays.IsFriday;
                satCheckbox.Checked = distroDays.IsSaturday;

                minDollarBox.Value = minDollarLabel.InnerText = distroDays.MinDollars.ToString();
                dayRangeBox.Value  = dayRangeLabel.InnerText = distroDays.DayRange.ToString();

                var itemData = ItemTable.GetItemData(user);

                editGrid.DataSource = itemData;
                editGrid.DataBind();
                editGrid.HeaderRow.TableSection = System.Web.UI.WebControls.TableRowSection.TableHeader;

                itemGrid.DataSource = itemData;
                itemGrid.DataBind();
                itemGrid.HeaderRow.TableSection = System.Web.UI.WebControls.TableRowSection.TableHeader;
            };
            Page.RegisterAsyncTask(new PageAsyncTask((sndr, args, callback, extraData) => { return(_fetchList.BeginInvoke(HttpContext.Current.Session, callback, extraData)); }, empty => { }, empty => { }, null));
        }
Пример #17
0
        private void itemTableButton_Click(object sender, EventArgs e)
        {
            ItemTable aItemTable = new ItemTable();

            aItemTable.Show();
            this.Hide();
        }
Пример #18
0
        // TODO: Base class voor table scrolls
        protected override void OnKeyboardChanged(bool visible, nfloat keyboardHeight)
        {
            View.SetNeedsUpdateConstraints();

            var contentOffset = ItemTable.ContentOffset;

            var keyboardHeightChange = visible ? (nfloat)Math.Abs(keyboardHeight - _currentKeyboardHeight) : (nfloat)Math.Abs(_currentKeyboardHeight - 0);

            if (visible)
            {
                InputBoxBottomConstraint.Constant = keyboardHeight + _originalInputBoxConstraint;

                contentOffset.Y += keyboardHeightChange;
            }
            else
            {
                InputBoxBottomConstraint.Constant = _originalInputBoxConstraint;

                contentOffset.Y -= keyboardHeightChange;
            }

            _currentKeyboardHeight = visible ? keyboardHeight : 0;

            ItemTable.SetContentOffset(contentOffset, false);

            View.LayoutIfNeeded();
        }
Пример #19
0
    public static void init(SCBaseInfo baseInfo)
    {
        gold = baseInfo.Gold;
        foreach (PBItemTable it in baseInfo.ItemTable)
        {
            ItemTable itemTable = new ItemTable();
            itemTable.Id       = it.Id;
            itemTable.ItemType = it.ItemType;
            itemTable.Para1    = it.Para1;
            itemTable.Para2    = it.Para2;
            itemTable.Price    = it.Price;
            itemTables.Add(itemTable.Id, itemTable);
        }

        foreach (PBUnitTable ut in baseInfo.UnitTable)
        {
            UnitTable unitTable = new UnitTable();
            unitTable.Id = ut.Id;
            string[] itemStrs = ut.Items.Split('|');
            unitTable.Items = new Dictionary <int, int> ();
            foreach (string itemStr in itemStrs)
            {
                if (itemStr.Length == 0)
                {
                    continue;
                }
                string[] strs = itemStr.Split(';');
                unitTable.Items.Add(int.Parse(strs[0]), int.Parse(strs[1]));
            }
            unitTable.Price = ut.Price;
            unitTables.Add(unitTable.Id, unitTable);
        }

        foreach (PBPeckTable pt in baseInfo.PeckTable)
        {
            PeckTable peckTable = new PeckTable();
            peckTable.Id      = pt.Id;
            peckTable.gold    = pt.Gold;
            peckTable.goldNum = pt.Gold;
            if (pt.Items != null && pt.Items.Length > 0)
            {
                peckTable.Items = new Dictionary <int, int> ();
                string[] itemStrs = pt.Items.Split('|');
                peckTable.Items = new Dictionary <int, int> ();
                foreach (string itemStr in itemStrs)
                {
                    if (itemStr.Length == 0)
                    {
                        continue;
                    }
                    string[] strs = itemStr.Split(';');
                    peckTable.Items.Add(int.Parse(strs[0]), int.Parse(strs[1]));
                }
            }
            peckTable.Price = pt.Price;

            peckTables.Add(peckTable.Id, peckTable);
        }
    }
Пример #20
0
 static public void Spawn(Vector2 pos, List <ItemTable> table)
 {
     if (table.Count > 0)
     {
         ItemTable s = table[Random.Range(0, table.Count)];
         Spawn(pos, s.type, s.id, Random.Range(s.minnum, s.maxnum));
     }
 }
Пример #21
0
        public async Task <long> CreateAsync(ItemTable entity)
        {
            string sqlQuery = @"INSERT INTO Item (ItemNumber, IdVendor, UPC, ItemDescription, MinimumOrderQuantity, PurchaseUnitOfMeasure, ItemCost) " +
                              "VALUES (@ItemNumber, @IdVendor, @UPC, @ItemDescription, @MinimumOrderQuantity, @PurchaseUnitOfMeasure, @ItemCost) " +
                              "SELECT CAST(SCOPE_IDENTITY() as bigint)";

            return(await DbQuerySingleAsync <long>(sqlQuery, entity));
        }
 public MemoryDatabase(
     ItemTable ItemTable,
     ItemTierTable ItemTierTable
     )
 {
     this.ItemTable     = ItemTable;
     this.ItemTierTable = ItemTierTable;
 }
Пример #23
0
 public PlayerService(IUnitOfWork unitOfWork, IItemService itemService, IdFactory idFactory, ItemTable itemTable, Config.Config config)
 {
     _unitOfWork  = unitOfWork;
     _itemService = itemService;
     _idFactory   = idFactory;
     _itemTable   = itemTable;
     _config      = config;
 }
Пример #24
0
        private static ItemTable GetRandom(List <ItemTable> pool)
        {
            var       found          = false;
            ItemTable itemDefinition = null;

            while (!found)
            {
                itemDefinition = pool[RandomHelper.Next(0, pool.Count() - 1)];

                if (itemDefinition.SNOActor == -1)
                {
                    continue;
                }

                // if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue != 0)) return itemDefinition; // testing books /xsochor
                // if (itemDefinition.ItemType1 != StringHashHelper.HashItemName("Book")) continue; // testing books /xsochor
                // if (!ItemGroup.SubTypesToHashList("SpellRune").Contains(itemDefinition.ItemType1)) continue; // testing spellrunes /xsochor

                // ignore gold and healthglobe, they should drop only when expect, not randomly
                if (itemDefinition.Name.ToLower().Contains("gold"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("healthglobe"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("pvp"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("unique"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("crafted"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("debug"))
                {
                    continue;
                }
                if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue == 0))
                {
                    continue;                                                                                                             // i hope it catches all lore with npc spawned /xsochor
                }
                if (!GBIDHandlers.ContainsKey(itemDefinition.Hash) &&
                    !AllowedItemTypes.Contains(itemDefinition.ItemType1))
                {
                    continue;
                }

                found = true;
            }

            return(itemDefinition);
        }
Пример #25
0
        public async Task <bool> UpdateAsync(ItemTable entity)
        {
            string sql = $@"IF EXISTS (SELECT 1 FROM Item WHERE ID = @Id) " +
                         "UPDATE Item SET ItemNumber = @ItemNumber, IdVendor = @IdVendor, UPC = @UPC, ItemDescription = @ItemDescription, MinimumOrderQuantity = @MinimumOrderQuantity, " +
                         "PurchaseUnitOfMeasure = @PurchaseUnitOfMeasure, ItemCost = @ItemCost " +
                         "WHERE ID = @Id";

            return(await DbExecuteAsync <bool>(sql, entity));
        }
Пример #26
0
 public PlayerService(IPlayerRepository playerRepository, IItemService itemService, ISkillRepository skillRepository, IdFactory idFactory, ItemTable itemTable, Config.Config config)
 {
     _itemService      = itemService;
     _idFactory        = idFactory;
     _itemTable        = itemTable;
     _config           = config;
     _skillRepository  = skillRepository;
     _playerRepository = playerRepository;
 }
Пример #27
0
 private void ApplyDurability(ItemTable definition)
 {
     if (definition.DurabilityMin > 0)
     {
         int durability = definition.DurabilityMin + RandomHelper.Next(definition.DurabilityDelta);
         Attributes[GameAttribute.Durability_Cur] = durability;
         Attributes[GameAttribute.Durability_Max] = durability;
     }
 }
Пример #28
0
            public void AddCharacter(string character, Point location, Point size)
            {
                text += character;

                Rectangle rect    = new Rectangle(location, size);
                ItemTable newItem = new ItemTable(rect, character);

                item.Add(++index, newItem);
            }
Пример #29
0
 private void ApplyArmorSpecificOptions(ItemTable definition)
 {
     if (definition.ArmorValue > 0)
     {
         Attributes[GameAttribute.Armor_Item] += definition.ArmorValue;
         //scripted //Attributes[GameAttribute.Armor_Item_SubTotal] += definition.ArmorValue;
         //scripted //Attributes[GameAttribute.Armor_Item_Total] += definition.ArmorValue;
     }
 }
Пример #30
0
        //end select title
        /// <summary>
        /// returns titleid if save is successful
        /// </summary>
        /// <param name="booktitle"></param>
        /// <returns></returns>
        public static int InsertItem(ItemTable item)
        {
            db4oManager.WithContainer(container =>
            {
                container.Store(item);
            });

            return item.TitleID;
        }
Пример #31
0
    private void DamegeToItemTable(Collider2D collision)
    {
        ItemTable table = collision.gameObject.GetComponent <ItemTable>();

        if (table != null)
        {
            table.GetDamage(power);
        }
    }
Пример #32
0
        public Item(GS.Map.World world, ItemTable definition, IEnumerable<Affix> affixList, string serializedGameAttributeMap)
            : base(world, definition.SNOActor)
        {
            SetInitialValues(definition);
            this.Attributes.FillBySerialized(serializedGameAttributeMap);
            this.AffixList.Clear();
            this.AffixList.AddRange(affixList);

            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;
            /*
            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
                Attributes[GameAttribute.Item_Quality_Level] = 3;
            */
            //Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            //Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);
            /*
            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
                RandomGenerator.Next(); // next value is used but unknown if armor
            RandomGenerator.ReinitSeed();*/
        }
Пример #33
0
        private void ApplyWeaponSpecificOptions(ItemTable definition)
        {
            if (definition.WeaponDamageMin > 0)
            {
                Attributes[GameAttribute.Attacks_Per_Second_Item] += definition.AttacksPerSecond;
                //scripted //Attributes[GameAttribute.Attacks_Per_Second_Item_Subtotal] += definition.AttacksPerSecond;
                //scripted //Attributes[GameAttribute.Attacks_Per_Second_Item_Total] += definition.AttacksPerSecond;

                Attributes[GameAttribute.Damage_Weapon_Min, 0] += definition.WeaponDamageMin;
                //scripted //Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] += definition.WeaponDamageMin;

                Attributes[GameAttribute.Damage_Weapon_Delta, 0] += definition.WeaponDamageDelta;
                //scripted //Attributes[GameAttribute.Damage_Weapon_Delta_SubTotal, 0] += definition.WeaponDamageDelta;
                //scripted //Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0] += definition.WeaponDamageDelta;

                //scripted //Attributes[GameAttribute.Damage_Weapon_Max, 0] += Attributes[GameAttribute.Damage_Weapon_Min, 0] + Attributes[GameAttribute.Damage_Weapon_Delta, 0];
                //scripted //Attributes[GameAttribute.Damage_Weapon_Max_Total, 0] += Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] + Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];

                //scripted //Attributes[GameAttribute.Damage_Weapon_Min_Total_All] = definition.WeaponDamageMin;
                //scripted //Attributes[GameAttribute.Damage_Weapon_Delta_Total_All] = definition.WeaponDamageDelta;
            }
        }
Пример #34
0
 private void ApplyArmorSpecificOptions(ItemTable definition)
 {
     if (definition.ArmorValue > 0)
     {
         Attributes[GameAttribute.Armor_Item] += definition.ArmorValue;
         //scripted //Attributes[GameAttribute.Armor_Item_SubTotal] += definition.ArmorValue;
         //scripted //Attributes[GameAttribute.Armor_Item_Total] += definition.ArmorValue;
     }
 }
Пример #35
0
 /// <summary>
 /// update booktitle based in id
 /// </summary>
 /// <param name="booktitle"></param>
 public static void UpdateItem(ItemTable item)
 {
     db4oManager.WithContainer(container =>
     {
         // The office object that is passed to this procedure is not connected to
         // the db4o container so we first have to do that.
         List<ItemTable> _list = (from ItemTable i in container
                                  where i.TitleID ==  item.TitleID && i.OrderNumber == item.OrderNumber  
                                  select i).ToList();
         if (_list != null)
         {
             // Then we should pass the properties from the updated object to the 
             // selected one. 
             // TODO: Maybe we could make a reflection procedure for this?
             _list[0].OrderNumber = item.OrderNumber;
             _list[0].Title = item.Title;
             _list[0].Copies = item.Copies;
             _list[0].Isbn = item.Isbn;
             _list[0].Impression  = item.Impression;
             _list[0].PONumber = item.PONumber;
             _list[0].OtherRef = item.OtherRef;
             _list[0].TotalValue = item.TotalValue;
             _list[0].SSRNo  = item.SSRNo;
             _list[0].SSRDate = item.SSRDate;
             _list[0].PerCopy = item.PerCopy;
             container.Store(_list[0]);
         }
     });
 }
Пример #36
0
 private void ApplyDurability(ItemTable definition)
 {
     if (definition.DurabilityMin > 0)
     {
         int durability = definition.DurabilityMin + RandomHelper.Next(definition.DurabilityDelta);
         Attributes[GameAttribute.Durability_Cur] = durability;
         Attributes[GameAttribute.Durability_Max] = durability;
     }
 }
Пример #37
0
 private void ApplySkills(ItemTable definition)
 {
     if (definition.SNOSkill0 != -1)
     {
         Attributes[GameAttribute.Skill, definition.SNOSkill0] = 1;
     }
     if (definition.SNOSkill1 != -1)
     {
         Attributes[GameAttribute.Skill, definition.SNOSkill1] = 1;
     }
     if (definition.SNOSkill2 != -1)
     {
         Attributes[GameAttribute.Skill, definition.SNOSkill2] = 1;
     }
     if (definition.SNOSkill3 != -1)
     {
         Attributes[GameAttribute.Skill, definition.SNOSkill3] = 1;
     }
 }
Пример #38
0
        private void ApplyAttributeSpecifier(ItemTable definition)
        {
            foreach (var effect in definition.Attribute)
            {
                float result;
                if (FormulaScript.Evaluate(effect.Formula.ToArray(), this.RandomGenerator, out result))
                {
                    //Logger.Debug("Randomized value for attribute " + GameAttribute.Attributes[effect.AttributeId].Name + " is " + result);

                    if (GameAttribute.Attributes[effect.AttributeId] is GameAttributeF)
                    {
                        var attr = GameAttribute.Attributes[effect.AttributeId] as GameAttributeF;
                        if (effect.SNOParam != -1)
                            Attributes[attr, effect.SNOParam] += result;
                        else
                            Attributes[attr] += result;
                    }
                    else if (GameAttribute.Attributes[effect.AttributeId] is GameAttributeI)
                    {
                        var attr = GameAttribute.Attributes[effect.AttributeId] as GameAttributeI;
                        if (effect.SNOParam != -1)
                            Attributes[attr, effect.SNOParam] += (int)result;
                        else
                            Attributes[attr] += (int)result;
                    }
                }
            }
        }
Пример #39
0
        public Item(GS.Map.World world, ItemTable definition)
            : base(world, definition.SNOActor)
        {
            SetInitialValues(definition);
            this.ItemHasChanges = true;//initial, this is set to true.
            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
                Attributes[GameAttribute.Item_Quality_Level] = 3;

            Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);

            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
                RandomGenerator.Next(); // next value is used but unknown if armor
            RandomGenerator.ReinitSeed();

            ApplyWeaponSpecificOptions(definition);
            ApplyArmorSpecificOptions(definition);
            ApplyDurability(definition);
            ApplySkills(definition);
            ApplyAttributeSpecifier(definition);

            int affixNumber = 1;
            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            AffixGenerator.Generate(this, affixNumber);
        }
Пример #40
0
    /// <summary>
    /// update itemtable
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgridTitles_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView _grd = (ASPxGridView)sender;
        //need to get title from edit itemtemplate it won't be found in NewValues
        string _title = "";
        int _titleid = wwi_func.vint(e.Keys["TitleID"].ToString());
        GridViewDataColumn _col = (GridViewDataColumn)_grd.Columns["colTitle"];
        ASPxComboBox _cbo = (ASPxComboBox)_grd.FindEditRowCellTemplateControl(_col, "dxcbotitle");
        if (_cbo != null)
        {
            _title = _cbo.Text != null ? _cbo.Text.ToString() : "";
        }

        ItemTable _i = new ItemTable(_titleid);
        _i.Title = _title; //e.NewValues["Title"].ToString();
 
        if (e.NewValues["Copies"] != null) { _i.Copies = wwi_func.vint(e.NewValues["Copies"].ToString()); }
        if (e.NewValues["ISBN"] != null) { _i.Isbn = e.NewValues["ISBN"].ToString(); }
        if (e.NewValues["Impression"] != null) { _i.Impression = e.NewValues["Impression"].ToString(); }
        if (e.NewValues["PONumber"] != null) { _i.PONumber = e.NewValues["PONumber"].ToString(); }
        if (e.NewValues["OtherRef"] != null) { _i.OtherRef = e.NewValues["OtherRef"].ToString(); }
        if (e.NewValues["TotalValue"] != null) { _i.TotalValue = wwi_func.vdecimal(e.NewValues["TotalValue"].ToString()); }
        if (e.NewValues["SSRNo"] != null) { _i.SSRNo = e.NewValues["SSRNo"].ToString(); }
        if (e.NewValues["SSRDate"] != null) { _i.SSRDate = wwi_func.vdatetime(e.NewValues["SSRDate"].ToString()); }
        if (e.NewValues["PerCopy"] != null) { _i.PerCopy = wwi_func.vdouble(e.NewValues["PerCopy"].ToString()); }
           
        _i.Save();

        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit();
        //no need to rebind it will happen after callback anyway
        //bind_order_titles(); 
    }
Пример #41
0
    /// <summary>
    /// insert to itemtable
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgridTitles_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        //999909 is agood orderno for testing as has lot of titles
        ASPxGridView _grd = (ASPxGridView)sender;
        int _orderno = wwi_func.vint(wwi_security.DecryptString(get_token("pno"), "publiship"));
        if (_orderno > 0)
        {
            //need to get title from edit itemtemplate it won't be found in NewValues
            string _title = "";
            //int _titleid = 0;

            GridViewDataColumn _col = (GridViewDataColumn)_grd.Columns["colTitle"];
            ASPxComboBox _cbo = (ASPxComboBox)_grd.FindEditRowCellTemplateControl(_col, "dxcbotitle");
            if (_cbo != null) {
                _title = _cbo.Text != null? _cbo.Text.ToString(): ""; 

            }
            
            ItemTable _i = new ItemTable();
            _i.OrderNumber = _orderno;
            _i.Title = _title; //e.NewValues["Title"].ToString();

            if (e.NewValues["Copies"] != null) { _i.Copies = wwi_func.vint(e.NewValues["Copies"].ToString()); }
            if (e.NewValues["ISBN"] != null) { _i.Isbn = e.NewValues["ISBN"].ToString(); }
            if (e.NewValues["Impression"] != null) { _i.Impression = e.NewValues["Impression"].ToString(); }
            if (e.NewValues["PONumber"] != null) { _i.PONumber = e.NewValues["PONumber"].ToString(); }
            if (e.NewValues["OtherRef"] != null) { _i.OtherRef = e.NewValues["OtherRef"].ToString(); }
            if (e.NewValues["TotalValue"] != null) { _i.TotalValue = wwi_func.vdecimal(e.NewValues["TotalValue"].ToString()); }
            if (e.NewValues["SSRNo"] != null) { _i.SSRNo = e.NewValues["SSRNo"].ToString(); }
            if (e.NewValues["SSRDate"] != null) { _i.SSRDate = wwi_func.vdatetime(e.NewValues["SSRDate"].ToString()); }
            if (e.NewValues["PerCopy"] != null) { _i.PerCopy = wwi_func.vdouble(e.NewValues["PerCopy"].ToString()); }
            
            _i.Save();
        }
        
        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit(); 
        //no need to rebind it will happen after callback anyway
        //bind_order_titles(); 
        string _new = get_token("cno");
        if (!string.IsNullOrEmpty(_new))
        {
            this.dxlblInfo.Text = "";
            this.dxpnlMsg.ClientVisible = false;

        }
    }
        private bool Update(ItemTable it)
        {
            try
            {
                using (var conn = new SQLiteConnection("Data Source=" + Form1.db_file_item))
                {
                    conn.Open();
                    using (SQLiteTransaction sqlt = conn.BeginTransaction())
                    {
                        using (SQLiteCommand command = conn.CreateCommand())
                        {
                            string query = string.Format("UPDATE item_list SET name = '{0}', price = '{1}' WHERE id = '{2}'",
                            it.name,it.price,it.id);

                            command.CommandText = query;
                            command.ExecuteNonQuery();
                        }
                        sqlt.Commit();
                    }
                    conn.Close();
                }
                return true;
            }
            catch (Exception e)
            {
                System_log.ShowDialog(e.ToString());
                return false;
            }
        }
Пример #43
0
        private void SetInitialValues(ItemTable definition)
        {
            this.ItemDefinition = definition;
            this.ItemLevel = definition.ItemLevel;
            this.GBHandle.Type = (int)GBHandleType.Gizmo;
            this.GBHandle.GBID = definition.Hash;
            this.ItemType = ItemGroup.FromHash(definition.ItemType1);
            this.EquipmentSlot = 0;
            this.InventoryLocation = new Vector2D { X = 0, Y = 0 };
            this.Scale = 1.0f;
            this.RotationW = 0.0f;
            this.RotationAxis.Set(0.0f, 0.0f, 1.0f);
            this.CurrentState = ItemState.Normal;
            this.Field2 = 0x00000000;
            this.Field7 = 0;
            this.NameSNOId = -1;      // I think it is ignored anyways - farmy
            this.Field10 = 0x00;






        }