Пример #1
0
        private void MergeButton_Click(object sender, EventArgs e)
        {
            if (StorageCheckedListBox.CheckedItems.Count != 3)
            {
                Log.LogInfo("请选择三件同等级装备");
                return;
            }
            Equipment[] eq = new Equipment[3];
            int         j  = 0;

            for (int i = 0; i < StorageCheckedListBox.Items.Count; i++)
            {
                if (StorageCheckedListBox.GetItemChecked(i))
                {
                    eq[j] = (Equipment)StorageCheckedListBox.Items[i];
                    j     = j + 1;
                }
            }
            if (eq[0].Quality == eq[1].Quality && eq[0].Quality == eq[2].Quality && eq[0].Quality < 5)
            {
                EquipmentOperation.MergeEquipment(eq);
                UpdateStorage();
            }
            else
            {
                Log.LogInfo("请选择三件同等级装备");
            }
        }
Пример #2
0
 private void SellButton_Click(object sender, EventArgs e)
 {
     if (StorageCheckedListBox.CheckedItems.Count < 1)
     {
         Log.LogInfo("请选择一件装备");
         return;
     }
     for (int i = 0; i < StorageCheckedListBox.Items.Count; i++)
     {
         if (StorageCheckedListBox.GetItemChecked(i))
         {
             Equipment eq = (Equipment)StorageCheckedListBox.Items[i];
             EquipmentOperation.SellEquipment(eq);
         }
     }
     UpdateStorage();
 }
Пример #3
0
 private void UnwearButton_Click(object sender, EventArgs e)
 {
     if (EquipedCheckedListBox.CheckedItems.Count < 1)
     {
         Log.LogInfo("请选择一件装备");
         return;
     }
     for (int i = 0; i < EquipedCheckedListBox.Items.Count; i++)
     {
         if (EquipedCheckedListBox.GetItemChecked(i))
         {
             Equipment eq = (Equipment)EquipedCheckedListBox.Items[i];
             EquipmentOperation.UnwearEquipment(eq.Type);
         }
     }
     UpdateStorage();
     UpdateWearedEquipment();
     UpdateState();
 }
Пример #4
0
        public static void ReadFile()
        {
            try
            {
                if (File.Exists(settingIni) == false)
                {
                    Log.LogInfo("找不到存档");
                    return;
                }

                GlobalSpace.storage.Clear();
                for (int i = 0; i <= GlobalSpace.maxType; i++)
                {
                    GlobalSpace.wearedEquipment[i] = null;
                }

                StreamReader sr = new StreamReader(settingIni);
                string       nextLine;
                string[]     eqcode;

                //读取存档版本(第一行)
                while ((nextLine = sr.ReadLine()) != null)
                {
                    eqcode = nextLine.Split(',');
                    if (eqcode[0] == versionChar)
                    {
                        Log.LogInfo("读取存档版本:v" + eqcode[1]);
                    }
                    else
                    {
                        Log.LogInfo("默认存档版本:v1");
                        //读取第一行内容
                        if (eqcode[0] == wearedEquipmentChar)
                        {
                            EquipmentOperation.CreateWearedRandomEquipment(Convert.ToInt32(eqcode[1]), Convert.ToInt32(eqcode[2]), Convert.ToInt32(eqcode[3]), Convert.ToInt32(eqcode[4]), Convert.ToInt32(eqcode[5]), Convert.ToInt32(eqcode[6]), Convert.ToInt32(eqcode[7]));
                        }
                        else if (eqcode[0] == storageChar)
                        {
                            EquipmentOperation.CreateRandomEquipment(Convert.ToInt32(eqcode[1]), Convert.ToInt32(eqcode[2]), Convert.ToInt32(eqcode[3]), Convert.ToInt32(eqcode[4]), Convert.ToInt32(eqcode[5]), Convert.ToInt32(eqcode[6]), Convert.ToInt32(eqcode[7]));
                        }
                        else if (eqcode[0] == strengthChar)
                        {
                            Form1.f.StrengthNumericUpDown.Value = Convert.ToInt32(eqcode[1]);
                        }
                        else if (eqcode[0] == militaryRankCountChar)
                        {
                            Form1.f.MilitaryRankComboBox.SelectedIndex = Convert.ToInt32(eqcode[1]);
                        }
                        else
                        {
                            Log.LogBug("未知标识字符:" + eqcode[0]);
                        }
                    }
                    break;
                }

                //读取存档内容
                while ((nextLine = sr.ReadLine()) != null)
                {
                    eqcode = nextLine.Split(',');
                    if (eqcode[0] == wearedEquipmentChar)
                    {
                        EquipmentOperation.CreateWearedRandomEquipment(Convert.ToInt32(eqcode[1]), Convert.ToInt32(eqcode[2]), Convert.ToInt32(eqcode[3]), Convert.ToInt32(eqcode[4]), Convert.ToInt32(eqcode[5]), Convert.ToInt32(eqcode[6]), Convert.ToInt32(eqcode[7]));
                    }
                    else if (eqcode[0] == storageChar)
                    {
                        EquipmentOperation.CreateRandomEquipment(Convert.ToInt32(eqcode[1]), Convert.ToInt32(eqcode[2]), Convert.ToInt32(eqcode[3]), Convert.ToInt32(eqcode[4]), Convert.ToInt32(eqcode[5]), Convert.ToInt32(eqcode[6]), Convert.ToInt32(eqcode[7]));
                    }
                    else if (eqcode[0] == strengthChar)
                    {
                        Form1.f.StrengthNumericUpDown.Value = Convert.ToInt32(eqcode[1]);
                    }
                    else if (eqcode[0] == militaryRankCountChar)
                    {
                        Form1.f.MilitaryRankComboBox.SelectedIndex = Convert.ToInt32(eqcode[1]);
                    }
                    else
                    {
                        Log.LogBug("未知标识字符:" + eqcode[0]);
                    }
                }

                sr.Close();
                Log.LogInfo("读取成功");
            }
            catch
            {
                Log.LogBug("读取失败");
            }
        }
Пример #5
0
        public static void GetEquipment(string url)
        {
            string s = GetGeneralContent(url);
            string eqtitle;

            string[]     eqs = new string[8];
            int          i   = 0;
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(s);
            HtmlNode node = doc.GetElementbyId("profileEquipmentNew");

            if (node == null)
            {
                Log.LogInfo("网页错误");
                return;
            }
            foreach (HtmlNode eqBox in node.ChildNodes)
            {
                foreach (HtmlNode eqBack in eqBox.ChildNodes)
                {
                    foreach (HtmlNode eqNode in eqBack.ChildNodes)
                    {
                        try
                        {
                            eqtitle = eqNode.Attributes["title"].Value;
                        }
                        catch
                        {
                            eqtitle = null;
                        }
                        if (eqtitle != null)
                        {
                            eqs[i] = eqtitle;
                            i      = i + 1;
                        }
                    }
                }
            }

            if (i != 8)
            {
                Log.LogBug("获取的装备信息有误");
            }



            foreach (string eqhtml in eqs)
            {
                if (eqhtml != "No item")
                {
                    /*  eqhtml内容:
                     *  div class="equipmentBack q4(品质)"
                     *      └div class="equipmentImage (future_)weapon4((set_)类型简称+品质)"
                     *  div class="equipmentBlueBox"
                     *      └<b>Q4 Weapon upgrade(品质+类型)</b>
                     *
                     *  -------------------------------特殊set时-------------------------------
                     *  div class="equipmentBlueBox"
                     *      └<b>Q5 Vision(品质+类型)</b>
                     *      └<span class="smallEqFnt"><br>Future Set(set类型)</span>
                     *  -----------------------------------------------------------------------
                     *
                     *  div class="tooltipDiv" style="height:auto !important;"
                     *      └<b>
                     *          └<bdo>Laser aiming module (#3197657)(名称和ID)</bdo>
                     *      └</b>
                     *      └div
                     *  div class="miniEquipmentRedCap"
                     *      └<i class="icon-lightning2" style="margin-top:8px!important;"></i>
                     *  <p class="miniStatsName">- Increase maximum damage by 7.88%</p>(属性+ by +数值)
                     *  div
                     *  div class="miniEquipmentRedCap"
                     *      └<i class="icon-danger" style="margin-top:8px!important;"></i>
                     *  <p class="miniStatsName">- Increase critical chance by 3.45%</p>(属性+ by +数值)
                     */

                    HtmlDocument eqdoc = new HtmlDocument();
                    eqdoc.LoadHtml(eqhtml);
                    string nodeClass;
                    string infoString;
                    int[]  setTypeQuality = new int[3];
                    int[]  pv1            = new int[2];
                    int[]  pv2            = new int[2];
                    bool   existpv1       = false;
                    foreach (HtmlNode eqInfoNode in eqdoc.DocumentNode.ChildNodes)
                    {
                        try
                        {
                            nodeClass = eqInfoNode.Attributes["class"].Value;
                        }
                        catch
                        {
                            nodeClass = null;
                        }
                        if (nodeClass != null)
                        {
                            if (nodeClass.StartsWith("equipmentBack") == true)
                            {
                                infoString     = eqInfoNode.ChildNodes[1].Attributes["class"].Value;
                                setTypeQuality = GetEquipmentSetTypeQuality(infoString);
                            }
                            if (nodeClass == "miniStatsName")
                            {
                                infoString = eqInfoNode.InnerText;
                                if (existpv1 == false)
                                {
                                    pv1      = GetEquipmentParameterValue(infoString);
                                    existpv1 = true;
                                }
                                else
                                {
                                    pv2 = GetEquipmentParameterValue(infoString);
                                }
                            }
                        }
                    }
                    EquipmentOperation.CreateWearedRandomEquipment(setTypeQuality[0], setTypeQuality[1], setTypeQuality[2], pv1[0], pv1[1], pv2[0], pv2[1]);
                }
            }
        }
Пример #6
0
 public override string ToString()
 {
     return(EquipmentOperation.GetEquipmentLineInfo(Set, Type, Quality, Parameter1, Value1, Parameter2, Value2));
 }
Пример #7
0
 private void RandomCreateEQButtonButton_Click(object sender, EventArgs e)
 {
     EquipmentOperation.CreateRandomEquipment(-1, -1, -1, -1, -1, -1, -1);
     UpdateStorage();
 }
Пример #8
0
 private void UpdateState()
 {
     StateTextBox.Text = EquipmentOperation.UpdateState(Convert.ToInt32(StrengthNumericUpDown.Value), MilitaryRankComboBox.SelectedIndex);
 }
Пример #9
0
 private void GetInfoFromCE(int set, int type, int quality, int sp1, int sv1, int sp2, int sv2)
 {
     EquipmentOperation.CreateRandomEquipment(set, type, quality, sp1, sv1, sp2, sv2);
     UpdateStorage();
 }