Exemple #1
0
 public Crafting(Player p, short size)
 {
     this.p = p;
     this.size = size;
     recipes = new List<TableData>();
     Table = new TableData(size);
     loadRecipies("LOL");
 }
Exemple #2
0
 public bool equals(TableData compare)
 {
     if (items == null) throw new NullReferenceException("You must add data using \"addData(Item[])\" before comparing");
     for (int i = 1; i < _size; i++)
     {
         if ((compare.items[i].id != this.items[i].id) || (compare.items[i].meta != this.items[i].meta))
             return false;
     }
     return true;
 }
Exemple #3
0
        public void CreateRecipe(string format, Item output, params object[] obj)
        {
            if (String.IsNullOrWhiteSpace(format)) throw new NullReferenceException("Recipe format is null");
            if (output == null) throw new NullReferenceException("Item output is null");
            if ((obj[0].GetType() != typeof(char[]) || obj[obj.Length - 1].GetType() != typeof(Item[])) && obj.Length % 2 != 0)
                throw new ArgumentException("Incorrect recipe format");
            Item[] iArray = new Item[size + 1];

            for (int i = 1; i < obj.Length; i += 2)
            {
                if (obj[i - 1].GetType() == typeof(char[]) && obj[i].GetType() == typeof(Item[]))
                {
                    char[] c = (char[])obj[i - 1];
                    Item[] e = (Item[])obj[i];
                    for (int j = 1; j <= size; j++)
                    {
                        for (int holyWtf = 0; holyWtf < c.Length; holyWtf++)
                        {
                            if (c[holyWtf] == format[j - 1])
                                iArray[j] = e[holyWtf];
                        }
                    }
                    iArray[0] = output;
                }
            }
            TableData data = new TableData(size);
            data.addData(iArray);
            recipes.Add(data);
        }