Esempio n. 1
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon        = src.Icon;
            m_race        = src.Race;
            m_slot        = src.Slot;
            m_family      = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList <Material>(0);
            m_properties   = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList <StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
            {
                return;
            }

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon = src.Icon;
            m_race = src.Race;
            m_slot = src.Slot;
            m_family = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList<Material>(0);
            m_properties = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
                return;

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
        public IHttpActionResult SetItemFamily([FromBody] ItemFamily ItemFamily)
        {
            var etiApp = Eti.Aplicacao;

            var familias = etiApp.Tabelas.Familias;

            var familia = familias.Find(ItemFamily.Code);

            if (familia.IsNew)
            {
                //ItemFamily does not exist in DB.
                familia.Codigo = ItemFamily.Code;
            }
            else
            {
                //ItemFamily allready in DB.
            }

            familia.Descricao        = ItemFamily.Description;
            familia.CodTpFamilia     = ItemFamily.CodTpFamilia;
            familia.LigCte           = ItemFamily.LigCte;
            familia.FichaReparticao  = ItemFamily.FichaReparticao;
            familia.IvaIncluido      = ItemFamily.IvaIncluido;
            familia.LimMargemLucro   = ItemFamily.LimMargemLucro;
            familia.LimMargemLucroTP = ItemFamily.LimMargemLucroTP;
            familia.MargemLucroMin   = ItemFamily.MargemLucroMin;
            familia.GranelPreco      = ItemFamily.GranelPreco;
            familia.GranelPrecoTotal = ItemFamily.GranelPrecoTotal;
            familia.PrefixoPreco     = ItemFamily.PrefixoPreco;
            familia.PrefixoQtd       = ItemFamily.PrefixoQtd;
            familia.PrcDigitosInt    = ItemFamily.PrcDigitosInt;
            familia.PrcDigitosDec    = ItemFamily.PrcDigitosDec;
            familia.QtdDigitosInt    = ItemFamily.QtdDigitosInt;
            familia.QtdDigitosDec    = ItemFamily.QtdDigitosDec;
            familia.EdicoesDigTot    = ItemFamily.EdicoesDigTot;
            familia.EdicoesDigEd     = ItemFamily.EdicoesDigEd;
            familia.PararQtd         = ItemFamily.PararQtd;
            familia.PararPreco       = ItemFamily.PararPreco;

            var lst = new List <string>();

            if (familias.Validate(familia, lst))
            {
                familias.Update(familia);
                if (string.IsNullOrEmpty(familia.EtiErrorCode))
                {
                    return(Ok());
                }
                else
                {
                    return(BadRequest(familia.EtiErrorDescription));
                }
            }
            else
            {
                return(BadRequest(familia.EtiErrorDescription + Environment.NewLine + string.Join(Environment.NewLine, lst)));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Update the subfamily and item type combo lists when the family or subfamily selection changes.
        /// </summary>
        /// <param name="reloadSubFamilies">If true, update the list of subfamilies and the list of item types. If false, only update the item types.</param>
        private void UpdateItemFinderCombos(bool reloadSubFamilies)
        {
            if (reloadSubFamilies)
            {
                itemSubFamilyCombo.DataSource = ItemFamily.GetSubFamilies(itemFamilyCombo.SelectedItem.ToString());
            }

            itemTypeCombo.DataSource = ItemFamily.GetItemNames(itemFamilyCombo.SelectedItem.ToString(), itemSubFamilyCombo.SelectedItem.ToString());
        }
Esempio n. 5
0
        public void LoadTabItemFinder()
        {
            // Initialize the item finder combo boxes
            itemFamilyCombo.DataSource    = ItemFamily.GetFamilies();
            itemQualityCombo.DataSource   = Enum.GetValues(typeof(GameLibrary.ItemQuality));
            itemQualityCombo.SelectedItem = GameLibrary.ItemQuality.Any;

            UpdateItemFinderCombos(true); // True = update the list of subfamilies and the list of item types.
        }
Esempio n. 6
0
        /// <summary>
        /// Base constructor for blueprints.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        internal Item(BlueprintMarketGroup group, SerializableBlueprint src)
            : this(src.ID, src.Name)
        {
            m_icon = src.Icon;
            m_metaGroup = src.MetaGroup;
            m_marketGroup = group;
            m_family = ItemFamily.Bpo;

            m_prerequisites = new FastList<StaticSkillLevel>(src.PrereqSkill != null ? src.PrereqSkill.Length : 0);
            if (src.PrereqSkill == null)
                return;

            foreach (var prereq in src.PrereqSkill)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Base constructor for blueprints.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        internal Item(BlueprintMarketGroup group, SerializableBlueprint src)
            : this(src.ID, src.Name)
        {
            m_icon        = src.Icon;
            m_metaGroup   = src.MetaGroup;
            m_marketGroup = group;
            m_family      = ItemFamily.Bpo;

            m_prerequisites = new FastList <StaticSkillLevel>(src.PrereqSkill != null ? src.PrereqSkill.Length : 0);
            if (src.PrereqSkill == null)
            {
                return;
            }

            foreach (var prereq in src.PrereqSkill)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Update the dataGridViewItems table with the list of items described by the Item Finder combos and present in the game map.
        /// Called when the "Find Items" button is clicked.
        /// </summary>
        private void FindItem()
        {
            // Stop here if the no saved game has been loaded yet.
            if (_savedGameLoaded == false)
            {
                log(LogLevel.Warning, "Can't find an item before a saved game has been loaded.");
                return;
            }

            dataGridViewItems.SuspendLayout();

            if (dataGridViewItems.DataSource != null)
            {
                dataGridViewItems.DataSource = null;
            }

            // Get the list of matching items from the game model and set it as the model for dataGridViewItems
            IList <GameLibrary.ItemID> itemIDs = ItemFamily.GetItemIDs(
                itemFamilyCombo.SelectedItem.ToString(),
                itemSubFamilyCombo.SelectedItem.ToString(),
                itemTypeCombo.SelectedItem.ToString());

            GameLibrary.ItemQuality quality = (GameLibrary.ItemQuality)Enum.Parse(typeof(GameLibrary.ItemQuality), itemQualityCombo.SelectedItem.ToString(), true);
            dataGridViewItems.DataSource = gnomoria.FindItems(itemIDs, quality);

            // Set various properties of the grid view
            dataGridViewItems.AllowUserToAddRows    = false;
            dataGridViewItems.AllowUserToDeleteRows = false;

            dataGridViewItems.Columns[0].Visible      = false;
            dataGridViewItems.Columns[1].Frozen       = true;
            dataGridViewItems.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

            dataGridViewItems.Sort(dataGridViewItems.Columns[1], ListSortDirection.Ascending); // Sort by Name Asc

            dataGridViewItems.ResumeLayout();

            // Update result
            findItemResultLabel.Text = "Found " + dataGridViewItems.Rows.Count + " objects.";
        }
Esempio n. 9
0
        /// <summary>
        /// Sets the item family according to its market group
        /// </summary>
        /// <param name="group"></param>
        /// <param name="itemFamily"></param>
        private static void SetItemFamilyByMarketGroup(SerializableMarketGroup group, ItemFamily itemFamily)
        {
            foreach (SerializableItem item in group.Items)
            {
                item.Family = itemFamily;
            }

            foreach (SerializableMarketGroup childGroup in group.SubGroups)
            {
                SetItemFamilyByMarketGroup(childGroup, itemFamily);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Sets the item family according to its market group
        /// </summary>
        /// <param name="group"></param>
        /// <param name="itemFamily"></param>
        private static void SetItemFamilyByMarketGroup(SerializableMarketGroup group, ItemFamily itemFamily)
        {
            foreach (SerializableItem item in group.Items)
            {
                item.Family = itemFamily;
            }

            foreach (SerializableMarketGroup childGroup in group.SubGroups)
            {
                SetItemFamilyByMarketGroup(childGroup, itemFamily);
            }
        }