Example #1
0
        public void SendItemType(EnumItemType type, string projectid = null)
        {
            var payload    = new Payload(type, new List <string>(), projectid);
            var cowMessage = new CowMessage(EnumAction.newList, _clientGuid, payload);

            Send(cowMessage);
        }
Example #2
0
 public Item(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel)
 {
     this.itemName    = _name;
     this.itemType    = _itype;
     this.itemLevel   = _itemLevel;
     this.itemQuality = _iquality;
 }
Example #3
0
        public float GetTaxRate(EnumItemType type)
        {
            float rate = 0f;

            switch (type)
            {
            case EnumItemType.Book:
                rate = 0.005f;
                break;

            case EnumItemType.Clothing:
                rate = 0.02f;
                break;

            case EnumItemType.Commodities:
                rate = 0.01f;
                break;

            case EnumItemType.Electronics:
                rate = 0.05f;
                break;

            case EnumItemType.Medicine:
                rate = 0f;
                break;

            case EnumItemType.Other:
            default:
                rate = 0.03f;
                break;
            }

            return(rate);
        }
Example #4
0
 public ItemStack(int id, EnumItemType type, byte data, String name) : base(new ResourceLocation("Logo.png"))
 {
     this.name = name;
     this.id   = id;
     this.type = type;
     this.data = data;
 }
Example #5
0
    public static GameObject GetItem(EnumItemType itemType)
    {
        switch (itemType)
        {
        case EnumItemType.POINT:
            return(Stage.PointItem);

        case EnumItemType.POWER:
            return(Stage.PowerItem);

        case EnumItemType.BIGPOWER:
            return(Stage.BigPowerItem);

        case EnumItemType.FULLPOWER:
            return(Stage.FullPowerItem);

        case EnumItemType.BOMB:
            return(Stage.BombItem);

        case EnumItemType.LIFE:
            return(Stage.LifeItem);

        default:
            return(null);
        }
    }
Example #6
0
File: Item.cs Project: Tonaplo/RPG
 public Item(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel)
 {
     this.itemName = _name;
     this.itemType = _itype;
     this.itemLevel = _itemLevel;
     this.itemQuality = _iquality;
 }
Example #7
0
        private Item CreateRandomItem()
        {
            Array        typeArray    = Enum.GetValues(typeof(EnumItemType));
            EnumItemType selectedType = (EnumItemType)typeArray.GetValue(_random.Next(0, typeArray.Length - 1));
            Item         result       = new Item(GetNewId())
            {
                Type = selectedType
            };

            result.Name  = string.Format("{0}{1:d3}", selectedType, result.ID);
            result.Price = Math.Abs(_random.Next(-3000, 9000)) / 100f;
            return(result);
        }
Example #8
0
        bool CheckUsedItem(int itemCode, EnumItemType itemType, Guid itemId)
        {
            if (itemCode <= 0 || itemId == Guid.Empty)
            {
                return(false);
            }
            var dicItem = CacheFactory.ItemsdicCache.GetItem(itemCode);

            if (dicItem == null || dicItem.ItemType != (int)itemType)
            {
                return(false);
            }
            return(true);
        }
Example #9
0
        public DicItemEntity RandomItem(EnumItemType itemType)
        {
            int type = (int)itemType;

            if (_itemTypesDic.ContainsKey(type))
            {
                var list  = _itemTypesDic[type];
                int index = RandomHelper.GetInt32WithoutMax(0, list.Count);
                return(list[index]);
            }
            else
            {
                return(null);
            }
        }
        public void loadInventory()
        {
            String s = GameEngine.runTime.getSection("inventory");

            String[] items = s.Split('|');
            foreach (String i in items)
            {
                String[] nbt = i.Split(',');
                if (nbt.Length > 1)
                {
                    EnumItemType et  = EnumItemType.item;
                    String       str = nbt[1];
                    if (str == EnumItemType.item.ToString())
                    {
                        et = EnumItemType.item;
                    }
                    if (str == EnumItemType.weapon.ToString())
                    {
                        et = EnumItemType.weapon;
                    }
                    if (str == EnumItemType.potion.ToString())
                    {
                        et = EnumItemType.potion;
                    }
                    if (str == EnumItemType.accessory.ToString())
                    {
                        et = EnumItemType.accessory;
                    }
                    if (str == EnumItemType.helmet.ToString())
                    {
                        et = EnumItemType.helmet;
                    }
                    if (str == EnumItemType.breastplate.ToString())
                    {
                        et = EnumItemType.breastplate;
                    }
                    if (str == EnumItemType.leggings.ToString())
                    {
                        et = EnumItemType.leggings;
                    }
                    if (str == EnumItemType.boots.ToString())
                    {
                        et = EnumItemType.boots;
                    }
                    inventory.items.Add(new ItemStack(int.Parse(nbt[0]), et, byte.Parse(nbt[2]), nbt[3]));
                }
            }
        }
Example #11
0
    public static GameObject DropItem(EnumItemType item, Vector2 pos, bool wide = false)
    {
        GameObject drop = Instantiate(GetItem(item), pos, Quaternion.identity);

        float x = 0;

        if (wide)
        {
            x = Random.Range(-2f, 2f);
        }

        drop.GetComponent <Rigidbody2D>().velocity = new Vector2(x, Random.Range(0, 6f));
        drop.transform.Translate(Random.Range(-1f, 1f), 0, 0);

        return(drop);
    }
Example #12
0
 public ItemInfoEntity(Guid itemId, int itemCode, EnumItemType itemType)
     : this(itemId, itemCode, (int)itemType)
 {
 }
Example #13
0
        public static void InsertNewRow(Item Item)
        {
            OleDbCommand  command = Connect();
            StringBuilder query   = new StringBuilder();

            query.Append("INSERT INTO [Items](");
            for (int i = 1; i < typeof(Item).GetProperties().Length - 1; i++)
            {
                query.Append(typeof(Item).GetProperties()[i].Name + ",");
            }
            query.Append(typeof(Item).GetProperties().Last().Name);

            query.Append(") VALUES(");



            foreach (PropertyInfo prop in Item.GetType().GetProperties())
            {
                //Kihagyja az első propertit az ID-t
                if (Item.GetType().GetProperties().ToList().IndexOf(prop) == 0)
                {
                    continue;
                }

                var type = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType;

                switch (type.Name)
                {
                case "Boolean":

                    if (bool.Parse(prop.GetValue(Item, null).ToString()))
                    {
                        query.Append("'1', ");
                    }
                    else
                    {
                        query.Append("'0', ");
                    }
                    break;

                case "EnumQuality":
                    EnumQuality enumQuality = (EnumQuality)Enum.Parse(typeof(EnumQuality), prop.GetValue(Item, null).ToString());
                    query.Append("'" + Array.IndexOf(EnumQuality.GetValues(enumQuality.GetType()), enumQuality) + "', ");
                    break;

                case "EnumItemType":
                    EnumItemType enumItemType = (EnumItemType)Enum.Parse(typeof(EnumItemType), prop.GetValue(Item, null).ToString());
                    query.Append("'" + Array.IndexOf(EnumItemType.GetValues(enumItemType.GetType()), enumItemType) + "', ");
                    break;

                case "EnumRarity":
                    EnumRarity enumRarity = (EnumRarity)Enum.Parse(typeof(EnumRarity), prop.GetValue(Item, null).ToString());
                    query.Append("'" + Array.IndexOf(EnumRarity.GetValues(enumRarity.GetType()), enumRarity) + "', ");
                    break;

                case "EnumPotionEffect":
                    EnumPotionEffect enumPotionEffect = (EnumPotionEffect)Enum.Parse(typeof(EnumPotionEffect), prop.GetValue(Item, null).ToString());
                    query.Append("'" + Array.IndexOf(EnumPotionEffect.GetValues(enumPotionEffect.GetType()), enumPotionEffect) + "', ");
                    break;

                case "EnumPossibleBonusStats":
                    EnumPossibleBonusStats enumPossibleBonusStats = (EnumPossibleBonusStats)Enum.Parse(typeof(EnumPossibleBonusStats), prop.GetValue(Item, null).ToString());
                    query.Append("'" + Array.IndexOf(EnumPossibleBonusStats.GetValues(enumPossibleBonusStats.GetType()), enumPossibleBonusStats) + "', ");
                    break;

                default:
                    //Az utolsót külön írja meg mert az utolsónál már le kell zárni a queryt ') -el
                    if (Item.GetType().GetProperties().ToList().IndexOf(prop) == Item.GetType().GetProperties().ToList().IndexOf(Item.GetType().GetProperties().ToList().Last()))
                    {
                        query.Append("'" + prop.GetValue(Item, null).ToString() + "')");
                    }
                    else
                    {
                        query.Append("'" + prop.GetValue(Item, null).ToString() + "', ");
                    }
                    break;
                }
            }

            command.CommandText = query.ToString();
            command.ExecuteNonQuery();
            command.Connection.Close();
        }
Example #14
0
 /// <summary>
 /// This function returns a random attribute to be added to an item. If the item is a BattleChar, Armor and Attackdamage can be returned, otherwise not.
 /// </summary>
 /// <param name="_random">The random number to generate the attribute from. This is usually the itemlevel of the item + a random, nonnegative number less than 47</param>
 /// <param name="_itype">The type of item</param>
 /// <returns>An Attribute for an item</returns>
 private static EnumAttributeType GetRandomAttribute(int _random, EnumItemType _itype)
 {
     if (_itype == EnumItemType.Battlecharm)
     {
         switch (r.Next(_random) % 9)
         {
             case 1:
                 return EnumAttributeType.Agility;
             case 2:
                 return EnumAttributeType.Health;
             case 3:
                 return EnumAttributeType.Intellect;
             case 5:
                 return EnumAttributeType.Strength;
             case 6:
                 return EnumAttributeType.Armor;
             case 7:
                 return EnumAttributeType.Crit;
             case 8:
                 return EnumAttributeType.Speed;
             default:
                 return EnumAttributeType.Attackdamage;
         }
     }
     else
     {
         switch (r.Next(_random) % 7)
         {
             case 1:
                 return EnumAttributeType.Agility;
             case 2:
                 return EnumAttributeType.Health;
             case 3:
                 return EnumAttributeType.Intellect;
             case 4:
                 return EnumAttributeType.Crit;
             case 5:
                 return EnumAttributeType.Speed;
             default:
                 return EnumAttributeType.Strength;
         }
     }
 }
Example #15
0
File: Payload.cs Project: bertt/cow
 public Payload(EnumItemType syncType, List <string> list, string project = null)
 {
     SyncType = syncType;
     List     = list;
     Project  = project;
 }
Example #16
0
 public void SetType(DesignPatterns___DC_Design.EnumItemType type)
 {
     _type = type;
 }
Example #17
0
 /// <summary>
 /// The main contructor to create a new weapon
 /// </summary>
 /// <param name="_name">The name of the Weapon</param>
 /// <param name="_itype">The Item type of the weapon. NOTE: This will always be EnumItemType.Weapon</param>
 /// <param name="_iquality">The quality of the weapon.</param>
 /// <param name="_itemLevel">The Itemlevel of the Weapon. NOTE: This will also be the base damage of the weapon</param>
 public Weapon(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel, EnumWeaponType _wtype, int _damage)
     : base(_name, _itype, _iquality, _itemLevel)
 {
     this.weaponType = _wtype;
     this.stats.Add(new UnitAttribute(EnumAttributeType.Attackdamage, _damage));
 }
Example #18
0
 public static Link ToEnumItemTypeLink(this EnumItemType source)
 {
     return(source.ToLink($"api/core/enumType/@parameter@"));
 }
Example #19
0
 public static ApiCollection <EnumItem> ToEnumItemApiCollection(this EnumItemType source)
 {
     return(source.EnumItems.ToApiCollection($"api/core/enumType/{source.NormalizedName}/item/@parameter@"));
 }
 public void SetType(EnumItemType type)
 {
     Type = type;
 }
Example #21
0
 public BattleCharm(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel)
     : base(_name, _itype, _iquality, _itemLevel)
 {
 }
Example #22
0
File: Armor.cs Project: Tonaplo/RPG
 public Armor(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel, EnumArmorType _atype, int _armor)
     : base(_name, _itype, _iquality, _itemLevel)
 {
     this.armorType = _atype;
     this.stats.Add(new UnitAttribute(EnumAttributeType.Armor, _armor));
 }
Example #23
0
 public static string GetItemSubTypeStr(EnumItemType itemType, int subType)
 {
     return(GetItemSubTypeStr((int)itemType, subType));
 }
Example #24
0
 public BattleCharm(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel)
     : base(_name, _itype, _iquality, _itemLevel)
 {
 }
Example #25
0
 /// <summary>
 /// The main contructor to create a new weapon
 /// </summary>
 /// <param name="_name">The name of the Weapon</param>
 /// <param name="_itype">The Item type of the weapon. NOTE: This will always be EnumItemType.Weapon</param>
 /// <param name="_iquality">The quality of the weapon.</param>
 /// <param name="_itemLevel">The Itemlevel of the Weapon. NOTE: This will also be the base damage of the weapon</param>
 public Weapon(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel, EnumWeaponType _wtype, int _damage)
     : base(_name, _itype, _iquality, _itemLevel)
 {
     this.weaponType = _wtype;
     this.stats.Add(new UnitAttribute(EnumAttributeType.Attackdamage, _damage));
 }
Example #26
0
 public DicItemEntity GetItemByType(int linkId, EnumItemType itemType)
 {
     return(GetItemByType(linkId, (int)itemType));
 }
 public ConstellationInfoEntity(Guid itemId, int itemCode, EnumItemType itemType)
     : this(itemId, itemCode, (int)itemType)
 {
 }
Example #28
0
 public Armor(string _name, EnumItemType _itype, EnumItemQuality _iquality, int _itemLevel, EnumArmorType _atype, int _armor) : base(_name, _itype, _iquality, _itemLevel)
 {
     this.armorType = _atype;
     this.stats.Add(new UnitAttribute(EnumAttributeType.Armor, _armor));
 }