Beispiel #1
0
        private static ItemBalancePartCollection GetItemBalancePartCollection(
            InfoDictionary <ItemTypeDefinition> itemTypes, Raw.ItemBalancePartCollection raw)
        {
            if (raw == null)
            {
                return(null);
            }

            ItemTypeDefinition type = null;

            if (string.IsNullOrEmpty(raw.Type) == false)
            {
                if (itemTypes.ContainsKey(raw.Type) == false)
                {
                    throw ResourceNotFoundException.Create("item type", raw.Type);
                }

                type = itemTypes[raw.Type];
            }

            return(new ItemBalancePartCollection()
            {
                Type = type,
                Mode = raw.Mode,
                AlphaParts = raw.AlphaParts,
                BetaParts = raw.BetaParts,
                GammaParts = raw.GammaParts,
                DeltaParts = raw.DeltaParts,
                EpsilonParts = raw.EpsilonParts,
                ZetaParts = raw.ZetaParts,
                EtaParts = raw.EtaParts,
                ThetaParts = raw.ThetaParts,
                MaterialParts = raw.MaterialParts,
            });
        }
Beispiel #2
0
    //-////////////////////////////////////////////////////
    ///
    public virtual void ModifyStat(ItemTypeDefinition argItemType, int valueAmount)
    {
        switch (argItemType)
        {
        case ItemTypeDefinition.MAXHEALTH:
            currentMaxHealth += valueAmount;
            this.gameObject.GetComponent <IHealable>()?.Heal(valueAmount);

            break;

        case ItemTypeDefinition.ATTACK:
            currentAttack += valueAmount;
            break;

        case ItemTypeDefinition.DEFENSE:
            currentDefense += valueAmount;
            break;

        case ItemTypeDefinition.SPEED:
            currentSpeed += valueAmount;
            break;

        case ItemTypeDefinition.BOND:
            //Todo: more complicated effect?
            break;
        }
    }
Beispiel #3
0
        private void SaveItemTypeDefinition()
        {
            FormLoading();

            try
            {
                ItemTypeDefinition lObjItemTypeDefinition = new ItemTypeDefinition();

                this.Dispatcher.Invoke(() =>
                {
                    lObjItemTypeDefinition.Id          = mLonDefinitionId;
                    lObjItemTypeDefinition.ItemTypeId  = mLonItemTypeId;
                    lObjItemTypeDefinition.AuctionType = cboAuctionType.SelectedValue.GetValue <AuctionTypeEnum>();
                });

                mObjInventoryFactory.GetItemTypeDefinitionService().SaveOrUpdate(lObjItemTypeDefinition);

                this.Dispatcher.Invoke(() => ResetForm());
            }
            catch (Exception lObjException)
            {
                FormDefult();
                ShowMessage("Error", lObjException.Message);
            }
            finally
            {
                FormDefult();
            }
        }
Beispiel #4
0
        private ItemTypeDefinition ReadItemTypeDefinition1()
        {
            ItemTypeDefinition result = new ItemTypeDefinition();

            result.ID     = reader.ReadString();
            result.Name   = reader.ReadString();
            result.SlotID = reader.ReadByte();
            //6 floats for mainstats
            result.MainStatMultipliers = new float[]
            {
                reader.ReadSingle(),
                    reader.ReadSingle(),
                    reader.ReadSingle(),
                    reader.ReadSingle(),
                    reader.ReadSingle(),
                    reader.ReadSingle()
            };

            result.AttributeRequirements    = new int[4];
            result.AttributeRequirements[0] = reader.ReadInt32();
            result.AttributeRequirements[1] = reader.ReadInt32();
            result.AttributeRequirements[2] = reader.ReadInt32();
            result.AttributeRequirements[3] = reader.ReadInt32();
            result.Icons        = ReadListOfInt();
            result.ItemCategory = (Items.ItemEquip.EquipCategories)reader.ReadInt32();

            return(result);
        }
 private bool Exists(ItemTypeDefinition pObjItemDefinition)
 {
     return(mObjItemTypeDefinitionDAO
            .GetEntitiesList()
            .Where(x => x.ItemTypeId == pObjItemDefinition.ItemTypeId &&
                   x.AuctionType == pObjItemDefinition.AuctionType &&
                   x.Id != pObjItemDefinition.Id)
            .Count() > 0 ? true : false);
 }
Beispiel #6
0
 private void itemtypelist_DoubleClick(object sender, EventArgs e)
 {
     if (itemtypelist.SelectedItems.Count != 1)
     {
         return;
     }
     CurrentItemType = (ItemTypeDefinition)itemtypelist.SelectedItem;
     EditCurrentItemType();
     slotselector.Refresh();
 }
 public void SaveOrUpdate(ItemTypeDefinition pObjItemDefinition)
 {
     if (!Exists(pObjItemDefinition))
     {
         mObjItemTypeDefinitionDAO.SaveOrUpdateEntity(pObjItemDefinition);
     }
     else
     {
         throw new Exception("La definición ingresada ya existe.");
     }
 }
        public void ReadItemTypesFeedFromXml()
        {
            string xml = "<?xml version='1.0' encoding='UTF-8'?>\n" +
                         "<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gm='http://base.google.com/ns-metadata/1.0'>\n" +
                         "  <id>http://www.google.com/base/feeds/itemtypes/en_US</id>\n" +
                         "  <updated>2006-08-24T14:32:27.228Z</updated>\n" +
                         "  <title type='text'>Item types for locale en_US</title>\n" +
                         "  <link rel='alternate' type='text/html' href='http://www.google.com'/>\n" +
                         "  <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/base/feeds/itemtypes/en_US'/>\n" +
                         "  <link rel='self' type='application/atom+xml' href='http://www.google.com/base/feeds/itemtypes/en_US?max-results=1&amp;key=ABQIAAAAfW6XRFfnNGUiegdqIq0KExT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS8MfEf7Ag6UI0Ony8Yq3gZHm6c9w'/>\n" +
                         "  <author>\n" +
                         "    <name>Google Inc.</name>\n" +
                         "    <email>[email protected]</email>\n" +
                         "  </author>\n" +
                         "  <generator version='1.0' uri='http://www.google.com'>GoogleBase</generator>\n" +
                         "  <openSearch:totalResults>1</openSearch:totalResults>\n" +
                         "  <openSearch:itemsPerPage>1</openSearch:itemsPerPage>\n" +
                         "  <entry>\n" +
                         "    <id>http://www.google.com/base/feeds/itemtypes/en_US/products</id>\n" +
                         "    <updated>2006-08-24T14:32:27.233Z</updated>\n" +
                         "    <category scheme='http://www.google.com/categories/itemtypes' term='products'/>\n" +
                         "    <title type='text'>products</title>\n" +
                         "    <content type='text'>products</content>\n" +
                         "    <gm:item_type>products</gm:item_type>\n" +
                         "    <gm:attributes>\n" +
                         "      <gm:attribute name='product type' type='text'/>\n" +
                         "      <gm:attribute name='condition' type='text'/>\n" +
                         "      <gm:attribute name='count' type='int'/>\n" +
                         "    </gm:attributes>\n" +
                         "  </entry>\n" +
                         "</feed>";
            GBaseFeed  feed  = Parse(xml);
            GBaseEntry entry = feed.Entries[0] as GBaseEntry;

            Assert.IsNotNull(entry, "entry");

            ItemTypeDefinition def = entry.ItemTypeDefinition;

            Assert.IsNotNull(def, "ItemTypeDefinition");
            Assert.AreEqual("products", def.ItemType);
            Assert.AreEqual(3, def.Attributes.Count);
            Assert.AreEqual("product type", def.Attributes[0].Name);
            Assert.AreEqual(GBaseAttributeType.Text, def.Attributes[0].Type);
            Assert.AreEqual("condition", def.Attributes[1].Name);
            Assert.AreEqual(GBaseAttributeType.Text, def.Attributes[1].Type);
            Assert.AreEqual("count", def.Attributes[2].Name);
            Assert.AreEqual(GBaseAttributeType.Int, def.Attributes[2].Type);
        }
Beispiel #9
0
        private void deleteItemTypeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ItemTypeDefinition removeme = (ItemTypeDefinition)itemtypelist.SelectedItem;

            itemtypes.Remove(removeme);
            itemtypelist.Items.Remove(removeme);
            if (itemtypes.Count > 0)
            {
                itemtypelist.SelectedIndex = 0;
            }
            else
            {
                CurrentItemType = null;
            }
            EditCurrentItemType();
        }
Beispiel #10
0
        private void createItemTypeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TextPrompt prompt = new TextPrompt();

            if (prompt.ShowDialog() == DialogResult.OK)
            {
                ItemTypeDefinition def = ItemTypeDefinition.CreateEmpty(prompt.Input);
                List <GameObject.Interfaces.IGameID> abs = itemtypes.ConvertAll(b => (GameObject.Interfaces.IGameID)b);
                //this will modify the Name if autoname is needed
                AddWithAutoname(def, abs, true);
                itemtypes.Add(def);
                itemtypelist.Items.Add(def);
                itemtypelist.SelectedItem = def;
                CurrentItemType           = def;
                EditCurrentItemType();
            }
        }
Beispiel #11
0
        public void ItemTypeDefinitionTest()
        {
            AttributeId[] ids = { new AttributeId("x", GBaseAttributeType.Int) };

            ExtensionList extList = ExtensionList.NotVersionAware();
            //extList.Add("garbage");
            //extList.Add(12);

            ItemTypeDefinition defs = new ItemTypeDefinition(extList);

            Assert.IsNull(defs.ItemType);
            Assert.IsNotNull(defs.Attributes);
            Assert.AreEqual(0, defs.Attributes.Count);

            extList.Add(new MetadataItemType("hello"));
            Assert.AreEqual("hello", defs.ItemType);

            extList.Add(new ItemTypeAttributes(new List <AttributeId>(ids)));
            Assert.AreEqual(1, defs.Attributes.Count);
            Assert.AreEqual("x", defs.Attributes[0].Name);
        }
Beispiel #12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            AbilityEffectDefinition.LoadDefinitions();

            MagicFileReader fr = new MagicFileReader();

            //load abilities
            abilities = fr.ReadAbilityFile();
            if (abilities.Count > 0)
            {
                foreach (ModularAbility ability in abilities)
                {
                    abilityselector.Items.Add(ability);
                }

                CurrentAbility = abilities[0];
                abilityselector.SelectedIndex = 0;
            }
            else
            {
                CurrentAbility = null;
            }
            EditCurrentAbility();

            //load classes
            classes = fr.ReadClassFile();
            if (classes.Count > 0)
            {
                foreach (CharacterTemplate t in classes)
                {
                    classlist.Items.Add(t);
                }

                CurrentClass            = classes[0];
                classlist.SelectedIndex = 0;
            }
            else
            {
                CurrentAbility = null;
            }
            EditCurrentClass();

            //load item type defs
            itemtypes = fr.ReadItemTypeDefinitionFile();
            if (itemtypes.Count > 0)
            {
                foreach (ItemTypeDefinition def in itemtypes)
                {
                    itemtypelist.Items.Add(def);
                }
                CurrentItemType            = itemtypes[0];
                itemtypelist.SelectedIndex = 0;
            }
            else
            {
                CurrentItemType = null;
            }


            //reload panel based editing controls
            panel1.Refresh();
        }