Esempio n. 1
0
        private static void AddCrystalRecipes()
        {
            foreach (var j in File.ReadAllLines(Path.Combine("GrowtopiaItemDatabase", "RecipeData", "CrystalRecipes.txt")))
            {
                if (String.IsNullOrEmpty(j) || j.StartsWith("//"))
                {
                    continue;
                }

                string[] str = j.Split('|');
                if (String.Equals(str[1], "CRYSTAL"))
                {
                    int         id    = Convert.ToInt32(str[0]);
                    CrystalType one   = CrystalRecipe.StringToCrystal(str[2]);
                    CrystalType two   = CrystalRecipe.StringToCrystal(str[3]);
                    CrystalType three = CrystalRecipe.StringToCrystal(str[4]);
                    CrystalType four  = CrystalRecipe.StringToCrystal(str[5]);
                    CrystalType five  = CrystalRecipe.StringToCrystal(str[6]);

                    if (str.Length > 7)
                    {
                        int gives = Convert.ToInt32(str[7]);
                        items[id].CrystalRecipe = new CrystalRecipe(one, two, three, four, five, gives);
                    }
                    else
                    {
                        items[id].CrystalRecipe = new CrystalRecipe(one, two, three, four, five);
                    }
                }
            }
        }
Esempio n. 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            Amount      = reader.ReadInt();
            CrystalType = (CrystalType)reader.ReadInt();
        }
Esempio n. 3
0
 public Crystal(CrystalType type)
     : base(7964)
 {
     CrystalType = type;
     DecaysAt    = DateTime.UtcNow + TimeSpan.FromDays(7);
     Timer       = new DecayTimer(this);
     Timer.Start();
 }
        public static T GetAttributeOfType <T>(this CrystalType enumVal) where T : System.Attribute
        {
            var type       = enumVal.GetType();
            var memInfo    = type.GetMember(enumVal.ToString());
            var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);

            return((attributes.Length > 0) ? (T)attributes[0] : null);
        }
Esempio n. 5
0
 public CrystalRecipe(CrystalType one, CrystalType two, CrystalType three, CrystalType four, CrystalType five, int gives = 1)
 {
     this.one   = one;
     this.two   = two;
     this.three = three;
     this.four  = four;
     this.five  = five;
     this.gives = gives;
 }
Esempio n. 6
0
        public Crystal(string type, Vector2 position)
        {
            if(type.Equals("Blue"))
                cType = CrystalType.blue;
            if(type.Equals("Red"))
                cType = CrystalType.red;
            if(type.Equals("Green"))
                cType = CrystalType.green;

            Initialize(position);
        }
Esempio n. 7
0
 private void SetCrystalType()
 {
     crystalType = crystalTypes.GetTypeForSize(crystalSize.level);
     if (isWell)
     {
         capacity = -1;
     }
     else
     {
         capacity = Mathf.FloorToInt(2 * Mathf.Pow(10, crystalSize.level));
     }
 }
Esempio n. 8
0
 public void pickUpCrystal(CrystalType crystal)
 {
     if (crystal == CrystalType.Red)
     {
         redCrystal = true;
         redCrystalImage.gameObject.SetActive(true);
     }
     else if (crystal == CrystalType.Blue)
     {
         blueCrystal = true;
         blueCrystalImage.gameObject.SetActive(true);
     }
     else if (crystal == CrystalType.Green)
     {
         greenCrystal = true;
         greenCrystalImage.gameObject.SetActive(true);
     }
 }
Esempio n. 9
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        Knight knight = collider.gameObject.GetComponent <Knight>();

        if (knight != null)
        {
            if (content == CrystalType.Random)
            {
                content = (CrystalType)Random.Range(1, 4);

                if (amount == 0)
                {
                    amount = Random.Range(1, 6);
                }
            }

            GameController.Instance.AddNewInventoryItem(content, amount);

            Destroy(gameObject);
        }
    }
Esempio n. 10
0
        public int GetCrystalCount(int enchantLevel)
        {
            CrystalType crystalType = GetCrystalType();

            if (enchantLevel > 3)
            {
                switch (Type2)
                {
                case 1:
                case 2:
                    return(CrystalCount + crystalType.CrystalEnchantBonusArmor * (3 * enchantLevel - 6));

                case 0:
                    return(CrystalCount + crystalType.CrystalEnchantBonusWeapon * (2 * enchantLevel - 3));

                default:
                    return(CrystalCount);
                }
            }

            if (enchantLevel <= 0)
            {
                return(CrystalCount);
            }

            switch (Type2)
            {
            case 1:
            case 2:
                return(CrystalCount + crystalType.CrystalEnchantBonusArmor * enchantLevel);

            case 0:
                return(CrystalCount + crystalType.CrystalEnchantBonusWeapon * enchantLevel);

            default:
                return(CrystalCount);
            }
        }
Esempio n. 11
0
 public bool IsAllowedType(CrystalType type)
 {
     return(allowedTypes.Contains(type));
 }
Esempio n. 12
0
 public CrystalHolder(CrystalType type, int amount = 0)
     : base(7964)
 {
     Amount      = amount;
     CrystalType = type;
 }
Esempio n. 13
0
    void ReplyStatIncrease(NetworkViewID increasingPlayerID, int aquiredType, int aquiredIncreaseStatValue)
    {
        type = (CrystalType)aquiredType;
        increaseStatValue = aquiredIncreaseStatValue;
        increasingPlayer = playerList.FindPlayer(ref increasingPlayerID);
        increasingPlayerStats = increasingPlayer.GetComponent<PlayerData>().stats;

        ApplyStatAccordingToType();
    }
Esempio n. 14
0
 public Crystal(CrystalType crystalType, TierType tier, LevelType level) : base(ItemType.Crystal, tier, level)
 {
     if (crystalType == CrystalType.Undefined) throw new ArgumentException("The crystal type is undefined.", nameof(crystalType));
     CrystalType = crystalType;
 }
Esempio n. 15
0
 public DragonCrystal(CrystalType type, int _count)
 {
     crystalType = type;
     count       = _count;
 }