示例#1
0
        private void tabOther1ClearCreate_Click(object sender, RoutedEventArgs e)
        {
            AllSelData asd  = new AllSelData();
            string     temp = "/clear @p " + asd.getItem(globalItemSel) + " " + globalItemMeta + " " + globalItemCount;

            if (tabOther1ClearHasName.IsChecked.Value || tabOther1ClearHasEnchant.IsChecked.Value || tabOther1ClearHasAttr.IsChecked.Value)
            {
                temp += " {";
            }
            if (tabOther1ClearHasName.IsChecked.Value)
            {
                temp += globalNLString + ",";
            }
            if (tabOther1ClearHasEnchant.IsChecked.Value)
            {
                temp += globalEnchString + ",";
            }
            if (tabOther1ClearHasAttr.IsChecked.Value)
            {
                temp += globalAttrString + ",";
            }
            if (globalHideflag != "")
            {
                temp += globalHideflag + ",";
            }
            if (tabOther1ClearHasName.IsChecked.Value || tabOther1ClearHasEnchant.IsChecked.Value || tabOther1ClearHasAttr.IsChecked.Value || globalHideflag != "")
            {
                if (temp.Length >= 1)
                {
                    temp = temp.Remove(temp.Length - 1, 1);
                }
                else
                {
                    //errorC = true;
                }
                temp += "}";
            }
            finalStr = temp;
            Check checkbox = new Check();

            checkbox.showText(finalStr);
            checkbox.Show();
        }
示例#2
0
        /// <summary>
        /// 为At窗口传值
        /// </summary>
        /// <returns>0:物品槽位,已转换成id\r\n1:物品英文id\r\n2:物品数量\r\n3:物品损害值\r\n4:物品的NBT数据,如无则空。</returns>
        public string[] returnStr()
        {
            AllSelData asd           = new AllSelData();
            int        itemslotindex = -1;

            if (tabRItemSlot.SelectedIndex < 7)
            {
                if (tabRItemSlot.SelectedIndex == 2)
                {
                    itemslotindex = -106;
                }
                if (tabRItemSlot.SelectedIndex == 3)
                {
                    itemslotindex = 100;
                }
                if (tabRItemSlot.SelectedIndex == 4)
                {
                    itemslotindex = 101;
                }
                if (tabRItemSlot.SelectedIndex == 5)
                {
                    itemslotindex = 102;
                }
                if (tabRItemSlot.SelectedIndex == 6)
                {
                    itemslotindex = 103;
                }
            }
            else if (tabRItemSlot.SelectedIndex < 43)
            {
                itemslotindex = tabRItemSlot.SelectedIndex - 7;
            }
            string nbtdata = string.Empty;

            if (finalStr.IndexOf('{') != -1)
            {
                nbtdata = finalStr.Substring(finalStr.IndexOf('{') + 1, finalStr.Length - finalStr.IndexOf('{') - 2);
            }
            return(new string[] { itemslotindex.ToString(), asd.getItem(tabRItemItem.SelectedIndex), tabRItemCount.Value.Value.ToString(), tabRItemMeta.Value.Value.ToString(), nbtdata });
        }
        private void checkBtn_Click(object sender, RoutedEventArgs e)
        {
            JObject allText = (JObject)JsonConvert.DeserializeObject(finalStr);

            if (!Directory.Exists(Directory.GetCurrentDirectory() + @"\data\"))
            {
                Directory.CreateDirectory(Directory.GetCurrentDirectory() + @"\data\");
            }
            AllSelData asd      = new AllSelData();
            string     filename = asd.getItem(ResultItem.SelectedIndex).Replace("minecraft:", "") + "_" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".json";

            using (FileStream fs = new FileStream(Directory.GetCurrentDirectory() + @"\data\" + filename, FileMode.Create))
            {
                using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8))
                {
                    sw.Write(allText);
                }
            }
            Check cbox = new Check();

            cbox.showText(finalStr, LootTableSaveTitle + @"\data\" + filename);
            cbox.Show();
        }
示例#4
0
        private void tabOther1TestforInvCreate_Click(object sender, RoutedEventArgs e)
        {
            AllSelData asd  = new AllSelData();
            string     temp = "/testfor @p {Inventory:[{Slot:" + tabOther1TestforInvSlot.Value + "b,id:\"" + asd.getItem(tabOther1TestforInvItem.SelectedIndex) + "\"";

            if (tabOther1TestforInvCount.Value > 1)
            {
                temp = temp + ",Count:" + tabOther1TestforInvCount.Value + "b";
            }
            if (tabOther1TestforInvMeta.Value > 0)
            {
                temp = temp + ",Damage:" + tabOther1TestforInvMeta.Value + "s";
            }
            if (globalNLString.Length > 0 || globalEnchString.Length > 0 || globalAttrString.Length > 0)
            {
                string tagTemp = "";
                if (globalNLString.Length > 0)
                {
                    tagTemp = tagTemp + globalNLString + ",";
                }
                if (globalEnchString.Length > 0)
                {
                    tagTemp = tagTemp + globalEnchString + ",";
                }
                if (globalAttrString.Length > 0)
                {
                    tagTemp = tagTemp + globalAttrString + ",";
                }
                if (globalHideflag != "")
                {
                    tagTemp += globalHideflag + ",";
                }
                if (tagTemp.Length >= 1)
                {
                    tagTemp = tagTemp.Remove(tagTemp.Length - 1, 1);
                }
                temp = temp + ",tag:{" + tagTemp + "}";
            }
            temp    += "}]}";
            finalStr = temp;
            Check checkbox = new Check();

            checkbox.showText(finalStr);
            checkbox.Show();
        }
示例#5
0
        private void tabOther1ItemFlyCreate_Click(object sender, RoutedEventArgs e)
        {
            if (tabOther1ItemFlySel.SelectedIndex < 0)
            {
                tabOther1ItemFlySel.SelectedIndex = 0;
            }
            string canget = "";

            if (tabOther1ItemFlyCantGet.IsChecked.Value)
            {
                canget = "32767";
            }
            else
            {
                canget = "0";
            }
            AllSelData asd = new AllSelData();

            if (mcVersion == "1.8" || mcVersion == "1.9/1.10")
            {
                finalStr = "/summon ArmorStand ~ ~1 ~ {Tags:[\"HoloItems\"],PersistenceRequired:1b,DisabledSlots:2039583,NoGravity:1b,Marker:1b,Invulnerable:1b,Invisible:1b,Passengers:[{id:Item,Tags:[\"HoloItems\"],Item:{id:\"" + asd.getItem(tabOther1ItemFlySel.SelectedIndex) + "\",Count:" + tabOther1ItemFlyCount.Value + "b,Damage:" + tabOther1ItemFlyDamage.Value + "s},PickupDelay:" + canget + ",Age:-32768}]}";
            }
            else
            {
                finalStr = "/summon armor_stand ~ ~1 ~ {Tags:[\"HoloItems\"],PersistenceRequired:1b,DisabledSlots:2039583,NoGravity:1b,Marker:1b,Invulnerable:1b,Invisible:1b,Passengers:[{id:Item,Tags:[\"HoloItems\"],Item:{id:\"" + asd.getItem(tabOther1ItemFlySel.SelectedIndex) + "\",Count:" + tabOther1ItemFlyCount.Value + "b,Damage:" + tabOther1ItemFlyDamage.Value + "s},PickupDelay:" + canget + ",Age:-32768}]}";
            }
            Check checkbox = new Check();

            checkbox.showText(finalStr);
            checkbox.Show();
        }
示例#6
0
        private void tabOther1HatCreate_Click(object sender, RoutedEventArgs e)
        {
            if (tabOther1HatSel.SelectedIndex < 0)
            {
                tabOther1HatSel.SelectedIndex = 0;
            }
            string nbt = "{";

            if (globalEnchString != "")
            {
                nbt += globalEnchString + ",";
            }
            if (globalNLString != "")
            {
                nbt += globalNLString + ",";
            }
            if (globalAttrString != "")
            {
                nbt += globalAttrString + ",";
            }
            if (globalHideflag != "")
            {
                nbt += globalHideflag + ",";
            }
            if (globalEnchString != "" || globalNLString != "" || globalAttrString != "" || globalHideflag != "")
            {
                if (nbt.Length >= 1)
                {
                    nbt = nbt.Remove(nbt.Length - 1, 1);
                }
                else
                {
                    //errorC = true;
                }
            }
            nbt += "}";
            AllSelData asd  = new AllSelData();
            string     temp = "/replaceitem entity @e[type=Player,c=1] slot.armor.head " + asd.getItem(tabOther1HatSel.SelectedIndex) + " " + tabOther1HatNum.Value + " " + tabOther1HatDamage.Value;

            if (tabOther1HatNBT.IsChecked.Value)
            {
                temp = temp + " " + nbt;
            }
            finalStr = temp;
            Check checkbox = new Check();

            checkbox.showText(finalStr);
            checkbox.Show();
        }
示例#7
0
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            if (atP.IsChecked.Value)
            {
                createText = "@p";
            }
            else if (atA.IsChecked.Value)
            {
                createText = "@a";
            }
            else if (atR.IsChecked.Value)
            {
                createText = "@r";
            }
            else if (atE.IsChecked.Value)
            {
                createText = "@e";
            }
            else if (atS.IsChecked.Value)
            {
                createText = "@s";
            }
            else
            {
                createText = "@p";
            }
            string extra = "";

            if (xyzCheck.IsChecked.Value)
            {
                extra += "x=" + x.Value.ToString() + ",y=" + y.Value.ToString() + ",z=" + z.Value.ToString() + ",";
            }
            if (dxCheck.IsChecked.Value)
            {
                extra += "dx=" + dx.Value.ToString() + ",";
                extra += "dy=" + dy.Value.ToString() + ",";
                extra += "dz=" + dz.Value.ToString() + ",";
            }
            if (rCheck.IsChecked.Value)
            {
                extra += "r=" + r.Value.ToString() + ",";
            }
            if (rmCheck.IsChecked.Value)
            {
                extra += "rm=" + rm.Value.ToString() + ",";
            }
            if (mCheck.IsChecked.Value)
            {
                if (mUN.IsChecked.Value)
                {
                    extra += "m=!" + m.Value.ToString() + ",";
                }
                else
                {
                    extra += "m=" + m.Value.ToString() + ",";
                }
            }
            if (rxCheck.IsChecked.Value)
            {
                extra += "rx=" + rx.Value.ToString() + ",";
            }
            if (rxmCheck.IsChecked.Value)
            {
                extra += "rxm=" + rxm.Value.ToString() + ",";
            }
            if (cCheck.IsChecked.Value)
            {
                extra += "c=" + c.Value.ToString() + ",";
            }
            if (ryCheck.IsChecked.Value)
            {
                extra += "ry=" + ry.Value.ToString() + ",";
            }
            if (rymCheck.IsChecked.Value)
            {
                extra += "rym=" + rym.Value.ToString() + ",";
            }
            if (lCheck.IsChecked.Value)
            {
                extra += "l=" + l.Value.ToString() + ",";
            }
            if (lmCheck.IsChecked.Value)
            {
                extra += "lm=" + lm.Value.ToString() + ",";
            }
            if (scoreCheck.IsChecked.Value)
            {
                extra += "score_" + scoreName.Text + "=" + score.Value.ToString() + ",";
            }
            if (scoreMinCheck.IsChecked.Value)
            {
                extra += "score_" + scoreMinName.Text + "_min=" + scoreMin.Value.ToString() + ",";
            }
            if (teamCheck.IsChecked.Value)
            {
                if (teamUN.IsChecked.Value)
                {
                    extra += "team=!" + team.Text + ",";
                }
                else
                {
                    extra += "team=" + team.Text + ",";
                }
            }
            if (nameCheck.IsChecked.Value)
            {
                if (nameUN.IsChecked.Value)
                {
                    extra += "name=!" + name.Text + ",";
                }
                else
                {
                    extra += "name=" + name.Text + ",";
                }
            }
            if (typeCheck.IsChecked.Value)
            {
                AllSelData asd = new AllSelData();
                if (typeUN.IsChecked.Value)
                {
                    extra += "type=!" + asd.getAt(type.SelectedIndex) + ",";
                }
                else
                {
                    extra += "type=" + asd.getAt(type.SelectedIndex) + ",";
                }
            }
            if (tagCheck.IsChecked.Value)
            {
                extra += "tag=" + tags.Text + ",";
            }
            if (NBTCheck.IsChecked.Value)
            {
                extra += "nbt=";
                if (NBTUN.IsChecked.Value)
                {
                    extra += "!";
                }
                extra += NBTTextbox.Text + ",";
            }
            if (extra.Length != 0)
            {
                extra       = extra.Remove(extra.Length - 1, 1);
                createText += "[" + extra + "]";
            }
            string nbt = "";

            if (flyCheck.IsChecked.Value)
            {
                nbt += "abilities:{flying:1b},";
            }
            if (handCheck.IsChecked.Value)
            {
                AllSelData asd   = new AllSelData();
                string     temp  = "";
                string     temp2 = "";
                if (handMeta.Value != -1)
                {
                    temp = ",Damage:" + handMeta.Value + "s";
                }
                if (getItemText.Text != "")
                {
                    temp2 = ",tag:{" + getItemText.Text + "}";
                }
                nbt += "SelectedItem:{id:\"" + asd.getItem(hand.SelectedIndex) + "\",Count:" + handCount.Value + "b" + temp + temp2 + "},";
            }
            if (itemCheck.IsChecked.Value && cmd != string.Empty)
            {
                nbt += cmd + ",";
            }
            if (InvCheck.IsChecked.Value && inv != string.Empty)
            {
                nbt += inv + ",";
            }
            if (rideCheck.IsChecked.Value)
            {
                AllSelData asd = new AllSelData();
                nbt += "RootVehicle:{Entity:{id:\"" + asd.getAt(rideEntity.SelectedIndex) + "\"}},";
            }
            if (nbt.Length != 0)
            {
                nbt         = nbt.Remove(nbt.Length - 1, 1);
                nbt         = "{" + nbt + "}";
                createText += " " + nbt;
            }
        }
示例#8
0
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            //errorC = false;
            if (tabRItemSlot.SelectedIndex < 0)
            {
                tabRItemSlot.SelectedIndex = 0;
            }
            if (tabRItemItem.SelectedIndex < 0)
            {
                tabRItemItem.SelectedIndex = 0;
            }
            if (tabRItemHide.SelectedIndex < 0)
            {
                tabRItemHide.SelectedIndex = 0;
            }
            string replaceItemStr = "";

            if (tabRItemEntity.IsChecked == true)
            {
                replaceItemStr += "/replaceitem entity " + atStr + " ";
                //if (tabRItemSlot.SelectedIndex == 0) errorC = true;
                //if (tabRItemItem.SelectedIndex == 0) errorC = true;
                AllSelData asd = new AllSelData();
                replaceItemStr = replaceItemStr + asd.getSlot(tabRItemSlot.SelectedIndex) + " " + asd.getItem(tabRItemItem.SelectedIndex) + " " + tabRItemCount.Value.Value + " " + tabRItemMeta.Value.Value;
                string meta = tabRItemGetBackMeta();
                if (tabRItemHasEnchant.IsChecked == true || tabRItemHasNL.IsChecked == true || tabRItemHasAttr.IsChecked == true)
                {
                    replaceItemStr += " {" + meta;
                }
                if (tabRItemUnbreaking.IsChecked == true && (tabRItemHasEnchant.IsChecked == true || tabRItemHasNL.IsChecked == true || tabRItemHasAttr.IsChecked == true))
                {
                    replaceItemStr += ",Unbreakable:1}";
                }
                else if (tabRItemUnbreaking.IsChecked == true && tabRItemHasEnchant.IsChecked == false && tabRItemHasNL.IsChecked == false && tabRItemHasAttr.IsChecked == false)
                {
                    replaceItemStr += " {Unbreakable:1}";
                }
                else if (tabRItemUnbreaking.IsChecked == false && (tabRItemHasEnchant.IsChecked == true || tabRItemHasNL.IsChecked == true || tabRItemHasAttr.IsChecked == true))
                {
                    replaceItemStr += "}";
                }
                finalStr = replaceItemStr;
            }
            else if (tabRItemBlock.IsChecked == true)
            {
                //if (tabRItemSlot.SelectedIndex == 0) errorC = true;
                //if (tabRItemItem.SelectedIndex == 0) errorC = true;
                replaceItemStr = replaceItemStr + "/replaceitem block ";
                if (tabRItemXNum.IsChecked == true)
                {
                    replaceItemStr = replaceItemStr + "~ ~ ~ ";
                }
                else
                {
                    replaceItemStr = replaceItemStr + tabRItemX.Value + " " + tabRItemY.Value + " " + tabRItemZ.Value + " ";
                }
                AllSelData asd = new AllSelData();
                replaceItemStr = replaceItemStr + asd.getSlot(tabRItemSlot.SelectedIndex) + " " + asd.getItem(tabRItemItem.SelectedIndex) + " " + tabRItemCount.Value.Value + " " + tabRItemMeta.Value.Value;
                string meta = tabRItemGetBackMeta();
                if (tabRItemHasEnchant.IsChecked == true || tabRItemHasNL.IsChecked == true || tabRItemHasAttr.IsChecked == true)
                {
                    replaceItemStr += " {" + meta;
                }
                if (tabRItemUnbreaking.IsChecked == true && (tabRItemHasEnchant.IsChecked == true || tabRItemHasNL.IsChecked == true || tabRItemHasAttr.IsChecked == true))
                {
                    replaceItemStr += ",Unbreakable:1}";
                }
                else if (tabRItemUnbreaking.IsChecked == true && tabRItemHasEnchant.IsChecked == false && tabRItemHasNL.IsChecked == false && tabRItemHasAttr.IsChecked == false)
                {
                    replaceItemStr += " {Unbreakable:1}";
                }
                else if (tabRItemUnbreaking.IsChecked == false && (tabRItemHasEnchant.IsChecked == true || tabRItemHasNL.IsChecked == true || tabRItemHasAttr.IsChecked == true))
                {
                    replaceItemStr += "}";
                }
                finalStr = replaceItemStr;
            }
            else
            {
                //errorC = true;
                //finalStr = "初始选择错误,请检查!";
            }
        }
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            AllSelData asd = new AllSelData();

            if (tabRPGOnlyBrokeSel.SelectedIndex < 0)
            {
                tabRPGOnlyBrokeSel.SelectedIndex = 0;
            }
            if (tabRPGOnlyPlaceSel.SelectedIndex < 0)
            {
                tabRPGOnlyPlaceSel.SelectedIndex = 0;
            }
            if (tabRPGBrokeMaxIndex >= globalRPGMaxIndex)
            {
                tabRPGBrokeMaxIndex = globalRPGMaxIndex - 1;
            }
            if (tabRPGPlaceMaxIndex >= globalRPGMaxIndex)
            {
                tabRPGPlaceMaxIndex = globalRPGMaxIndex - 1;
            }
            string giveDestroy = "";
            string givePlace   = "";

            if (tabRPGOnlyBroke.IsChecked.Value || tabRPGOnlyPlace.IsChecked.Value)
            {
                if (tabRPGOnlyBroke.IsChecked.Value)
                {
                    giveDestroy += "CanDestroy:[";
                    string give2 = "";
                    if (tabRPGBrokeCheckCanCreate == true)
                    {
                        for (int i = 0; i <= tabRPGBrokeMaxIndex; i++)
                        {
                            give2 = give2 + "\"" + asd.getItem(globalRPGBroke[i]) + "\",";
                        }
                        if (give2.Length >= 1)
                        {
                            give2 = give2.Remove(give2.Length - 1, 1);
                        }
                    }
                    else
                    {
                        this.ShowMessageAsync(FloatHelpTitle, AdvNeedNextBtn2Save, MessageDialogStyle.Affirmative, new MetroDialogSettings()
                        {
                            AffirmativeButtonText = FloatConfirm, NegativeButtonText = FloatCancel
                        });
                    }
                    giveDestroy += give2 + "]";
                }
                if (tabRPGOnlyPlace.IsChecked.Value)
                {
                    givePlace += "CanPlaceOn:[";
                    string give2 = "";
                    if (tabRPGPlaceCheckCanCreate == true)
                    {
                        for (int i = 0; i <= tabRPGPlaceMaxIndex; i++)
                        {
                            give2 = give2 + "\"" + asd.getItem(globalRPGPlace[i]) + "\",";
                        }
                        if (give2.Length >= 1)
                        {
                            give2 = give2.Remove(give2.Length - 1, 1);
                        }
                    }
                    else
                    {
                        this.ShowMessageAsync(FloatHelpTitle, AdvNeedNextBtn2Save, MessageDialogStyle.Affirmative, new MetroDialogSettings()
                        {
                            AffirmativeButtonText = FloatConfirm, NegativeButtonText = FloatCancel
                        });
                    }
                    givePlace += give2 + "]";
                }
                finalStrDestroy = giveDestroy;
                finalStrPlace   = givePlace;
            }
            else
            {
                finalStrDestroy = AdvNullSel;
                finalStrPlace   = AdvNullSel;
            }
        }
        private string backItemCom(ComboBox needChooseIndexComboBox, int whichIndex)
        {
            string whichItems       = "";
            string globalEnchString = "";
            string globalNLString   = "";
            string globalAttrString = "";
            string globalUnbreaking = "";
            string globalHideflag   = "";
            int    globalItemSel    = 0;
            int    globalItemCount  = 0;
            int    globalItemMeta   = 0;
            Item   itembox          = new Item();

            itembox.ShowDialog();
            string[] tempa = itembox.returnStr();
            int[]    tempb = itembox.returnStrAdver();
            if (tempa[0] != "ench:[]")
            {
                globalEnchString = tempa[0];
            }
            if (tempa[1] != "display:{}")
            {
                globalNLString = tempa[1];
            }
            if (tempa[2] != "AttributeModifiers:[]")
            {
                globalAttrString = tempa[2];
            }
            if (tempa[4] != "")
            {
                globalUnbreaking = tempa[4];
            }
            if (tempa[5] != "")
            {
                globalHideflag = tempa[5];
            }
            if (tempb[0] != 0)
            {
                globalItemSel = tempb[0];
            }
            globalItemCount = tempb[1];
            globalItemMeta  = tempb[2];
            //
            AllSelData asd = new AllSelData();

            needChooseIndexComboBox.SelectedIndex = globalItemSel;
            if (globalItemSel != 0)
            {
                int index = whichIndex - 1;
                whichItems = "" + index + ":{Slot:" + index + "b,id:\"" + asd.getItem(globalItemSel) + "\",Count:" + globalItemCount + "b,Damage:" + globalItemMeta + "s";
                if (globalEnchString != "" || globalNLString != "" || globalAttrString != "" || globalUnbreaking != "" || globalHideflag != "")
                {
                    whichItems += ",tag:{";
                    if (globalEnchString != "")
                    {
                        whichItems += globalEnchString + ",";
                    }
                    if (globalNLString != "")
                    {
                        whichItems += globalNLString + ",";
                    }
                    if (globalAttrString != "")
                    {
                        whichItems += globalAttrString + ",";
                    }
                    if (globalUnbreaking != "")
                    {
                        whichItems += globalUnbreaking + ",";
                    }
                    if (globalHideflag != "")
                    {
                        whichItems += globalHideflag + ",";
                    }
                    if (globalEnchString != "" || globalNLString != "" || globalAttrString != "" || globalUnbreaking != "" || globalHideflag != "")
                    {
                        whichItems = whichItems.Remove(whichItems.Count() - 1, 1);
                    }
                    whichItems += "}}";
                }
                else
                {
                    whichItems += "}";
                }
            }
            else
            {
                whichItems = "";
            }
            return(whichItems);
        }
 private void createBtn_Click(object sender, RoutedEventArgs e)
 {
     if (rbTestfor.IsChecked.Value)
     {
         finalStr = "/testfor " + at;
     }
     else
     {
         finalStr = "/execute " + at + " ~" + x.Value.Value + " ~" + y.Value.Value + " ~" + z.Value.Value + " ";
         if (executeCmd.Text.Substring(0, 1) == "/")
         {
             executeCmd.Text = executeCmd.Text.Substring(1, executeCmd.Text.Length - 1);
         }
         if (detectCheck.IsChecked.Value)
         {
             AllSelData asd = new AllSelData();
             finalStr += "detect ~" + x2.Value.Value + " ~" + y2.Value.Value + " ~" + z2.Value.Value + " " + asd.getItem(itemSel.SelectedIndex) + " " + blockData.Value.Value + " " + executeCmd.Text;
         }
         else
         {
             finalStr += executeCmd.Text;
         }
         finalStr = finalStr.Replace("~0", "~");
     }
 }
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            AllSelData asd = new AllSelData();

            finalStr = "{\"type\":\"";
            if (rbShaped.IsChecked.Value)
            {
                finalStr += "crafting_shaped\",";
                if (!string.IsNullOrWhiteSpace(Group.Text))
                {
                    finalStr += "\"group\":\"" + Group.Text + "\",";
                }
                finalStr          += "\"pattern\":[";
                string[,] pattern  = { { Shaped1.SelectedIndex.ToString(), Shaped2.SelectedIndex.ToString(), Shaped3.SelectedIndex.ToString() }, { Shaped4.SelectedIndex.ToString(), Shaped5.SelectedIndex.ToString(), Shaped6.SelectedIndex.ToString() }, { Shaped7.SelectedIndex.ToString(), Shaped8.SelectedIndex.ToString(), Shaped9.SelectedIndex.ToString() } };
                string[,] pattern2 = { { "0", "0", "0" }, { "0", "0", "0" }, { "0", "0", "0" } };
                for (int i = 2; i > -1; i--)
                {
                    if (pattern[i, 0] == "0" && pattern[i, 1] == "0" && pattern[i, 2] == "0")
                    {
                        if (i < 2 && pattern2[i + 1, 0] != "-1")
                        {
                        }
                        else
                        {
                            pattern2[i, 0] = "-1";
                            pattern2[i, 1] = "-1";
                            pattern2[i, 2] = "-1";
                        }
                    }
                    if (pattern[0, i] == "0" && pattern[1, i] == "0" && pattern[2, i] == "0")
                    {
                        if (i < 2 && pattern2[0, i + 1] != "-1")
                        {
                        }
                        else
                        {
                            pattern2[0, i] = "-1";
                            pattern2[1, i] = "-1";
                            pattern2[2, i] = "-1";
                        }
                    }
                }
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        if (pattern2[i, j] != "-1")
                        {
                            pattern2[i, j] = pattern[i, j];
                        }
                    }
                }
                for (int i = 0; i < 3; i++)
                {
                    if (!(pattern2[i, 0] == "-1" && pattern2[i, 1] == "-1" && pattern2[i, 2] == "-1"))
                    {
                        finalStr += "\"" + getPatternBack(int.Parse(pattern2[i, 0])) + getPatternBack(int.Parse(pattern2[i, 1])) + getPatternBack(int.Parse(pattern2[i, 2])) + "\"";
                        if (i != 3)
                        {
                            finalStr += ",";
                        }
                    }
                }
                if (finalStr.Substring(finalStr.Length - 1, 1) == ",")
                {
                    finalStr = finalStr.Substring(0, finalStr.Length - 1);
                }
                finalStr += "],\"key\":{";
                List <string> patternList = new List <string>();
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        int hasPattern = 0;
                        for (int k = 0; k < patternList.Count; k++)
                        {
                            if (pattern2[i, j] == patternList[k])
                            {
                                hasPattern++;
                            }
                        }
                        if (hasPattern == 0 && pattern2[i, j] != "-1" && pattern2[i, j] != "0")
                        {
                            patternList.Add(pattern2[i, j]);
                        }
                    }
                }
                for (int i = 0; i < patternList.Count; i++)
                {
                    string[] list = getItemBack(int.Parse(patternList[i])).Split(':');
                    finalStr += "\"" + getPatternBack(int.Parse(patternList[i])) + "\":{\"item\":\"" + asd.getItem(int.Parse(list[0])) + "\"";
                    if (bool.Parse(list[2]))
                    {
                        finalStr += ",\"data\":" + list[1];
                    }
                    finalStr += "}";
                    if (i != patternList.Count - 1)
                    {
                        finalStr += ",";
                    }
                    else
                    {
                        finalStr += "},";
                    }
                }
            }
            else
            {
                finalStr += "crafting_shapeless\",";
                if (!string.IsNullOrWhiteSpace(Group.Text))
                {
                    finalStr += "\"group\":\"" + Group.Text + "\",";
                }
                finalStr += "\"ingredients\":[";
                if (ItemList1.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList1.SelectedIndex) + "\"";
                    if (DataCheck1.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList1.ToolTip.ToString()
                                    .Substring(1, ItemList1.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList2.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList2.SelectedIndex) + "\"";
                    if (DataCheck2.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList2.ToolTip.ToString()
                                    .Substring(1, ItemList2.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList3.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList3.SelectedIndex) + "\"";
                    if (DataCheck3.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList3.ToolTip.ToString()
                                    .Substring(1, ItemList3.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList4.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList4.SelectedIndex) + "\"";
                    if (DataCheck4.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList4.ToolTip.ToString()
                                    .Substring(1, ItemList4.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList5.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList5.SelectedIndex) + "\"";
                    if (DataCheck5.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList5.ToolTip.ToString()
                                    .Substring(1, ItemList5.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList6.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList6.SelectedIndex) + "\"";
                    if (DataCheck6.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList6.ToolTip.ToString()
                                    .Substring(1, ItemList6.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList7.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList7.SelectedIndex) + "\"";
                    if (DataCheck7.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList7.ToolTip.ToString()
                                    .Substring(1, ItemList7.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList8.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList8.SelectedIndex) + "\"";
                    if (DataCheck8.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList8.ToolTip.ToString()
                                    .Substring(1, ItemList8.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (ItemList9.SelectedIndex != 0)
                {
                    finalStr += "{\"item\":\"" + asd.getItem(ItemList9.SelectedIndex) + "\"";
                    if (DataCheck9.IsChecked.Value)
                    {
                        finalStr += ",\"data\":" + ItemList9.ToolTip.ToString()
                                    .Substring(1, ItemList9.ToolTip.ToString().Length - 1);
                    }
                    finalStr += "},";
                }
                if (finalStr.Substring(finalStr.Length - 1, 1) == ",")
                {
                    finalStr = finalStr.Substring(0, finalStr.Length - 1);
                }
                finalStr += "],";
            }
            finalStr += "\"result\":{\"item\":\"" + asd.getItem(ResultItem.SelectedIndex) + "\"";
            if (ResultCount.Value.Value != 1)
            {
                finalStr += ",\"count\":" + ResultCount.Value.Value;
            }
            if (ResultDataCheck.IsChecked.Value)
            {
                finalStr += ",\"data\":" + ResultData.Value.Value;
            }
            finalStr += "}}";
        }
示例#13
0
 private void createBtn_Click(object sender, RoutedEventArgs e)
 {
     if (SFCheckCanCreate)
     {
         AllSelData asd        = new AllSelData();
         string     version    = "3";
         string     blockStack = "";
         string     biome      = "";
         string     other      = "";
         //blockStack
         for (int i = 0; i < SFMaxIndex; i++)
         {
             if (globalSFBlockCount[i] != 1)
             {
                 blockStack += globalSFBlockCount[i].ToString() + "*";
             }
             if (globalSFBlockID[i] != 0)
             {
                 blockStack += asd.getItem(globalSFBlockID[i]);
             }
             else
             {
                 blockStack += "minecraft:air";
             }
             if (globalSFBlockDamage[i] != 0)
             {
                 blockStack += ":" + globalSFBlockDamage[i];
             }
             blockStack += ",";
         }
         if (SFMaxIndex > 1)
         {
             blockStack = blockStack.Remove(blockStack.Count() - 1, 1);
         }
         //biome
         biome = asd.getBiomeID(biomeSel.SelectedIndex).ToString();
         //other
         if (CheckVillage.IsChecked.Value)
         {
             other += "village";
             if (CheckVillageSize.IsChecked.Value || CheckVillageDistance.IsChecked.Value)
             {
                 string add = "(";
                 if (CheckVillageSize.IsChecked.Value)
                 {
                     add += "size=" + VillageSize.Value.ToString() + " ";
                 }
                 if (CheckVillageDistance.IsChecked.Value)
                 {
                     add += "distance=" + VillageDistance.Value.ToString() + " ";
                 }
                 add    = add.Remove(add.Count() - 1, 1);
                 add   += ")";
                 other += add;
             }
             other += ",";
         }
         if (CheckMineshaft.IsChecked.Value)
         {
             other += "mineshaft";
             if (CheckMineshaftChance.IsChecked.Value)
             {
                 string add = "(";
                 add   += "chance=" + MineshaftChance.Value.ToString();
                 add   += ")";
                 other += add;
             }
             other += ",";
         }
         if (CheckStronghold.IsChecked.Value)
         {
             other += "stronghold";
             if (CheckStrongholdCount.IsChecked.Value || CheckStrongholdDistance.IsChecked.Value || CheckStrongholdSpread.IsChecked.Value)
             {
                 string add = "(";
                 if (CheckStrongholdCount.IsChecked.Value)
                 {
                     add += "count=" + StrongholdCount.Value.ToString() + " ";
                 }
                 if (CheckStrongholdDistance.IsChecked.Value)
                 {
                     add += "distance=" + StrongholdDistance.Value.ToString() + " ";
                 }
                 if (CheckStrongholdSpread.IsChecked.Value)
                 {
                     add += "spread=" + StrongholdSpread.Value.ToString() + " ";
                 }
                 add    = add.Remove(add.Count() - 1, 1);
                 add   += ")";
                 other += add;
             }
             other += ",";
         }
         if (CheckBiome.IsChecked.Value)
         {
             other += "biome_1";
             if (CheckBiomeChance.IsChecked.Value)
             {
                 string add = "(";
                 add   += "distance=" + BiomeChance.Value.ToString();
                 add   += ")";
                 other += add;
             }
             other += ",";
         }
         if (CheckDungeon.IsChecked.Value)
         {
             other += "dungeon,";
         }
         if (CheckDecoration.IsChecked.Value)
         {
             other += "decoration,";
         }
         if (CheckLake.IsChecked.Value)
         {
             other += "lake,";
         }
         if (CheckLavaLake.IsChecked.Value)
         {
             other += "lava_lake,";
         }
         if (CheckOceanmonument.IsChecked.Value)
         {
             other += "oceanmonument,";
         }
         if (other.Count() > 0)
         {
             other = other.Remove(other.Count() - 1, 1);
         }
         //create
         finalStr = version + ";" + blockStack + ";" + biome + ";" + other;
     }
     else
     {
         this.ShowMessageAsync("", SuperflatAtLeastClickOnce, MessageDialogStyle.Affirmative, new MetroDialogSettings()
         {
             AffirmativeButtonText = FloatConfirm, NegativeButtonText = FloatCancel, AnimateShow = true
         });
     }
 }