예제 #1
0
        public override bool TakeAction()
        {
            string puUserID;

            if (string.IsNullOrEmpty(toUserID))
            {
                puUserID = ContextUser.UserID;
            }
            else
            {
                puUserID = toUserID;
                UserCacheGlobal.LoadOffline(puUserID);
            }
            var package = UserEnchant.Get(puUserID);

            if (package != null)
            {
                userEnchantInfo = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID);
                if (userEnchantInfo != null)
                {
                    finalMature = CombatHelper.EnchantFinalNum(userEnchantInfo);
                    currExp     = userEnchantInfo.CurrExprience;
                    enchant     = new ConfigCacheSet <EnchantInfo>().FindKey(userEnchantInfo.EnchantID);
                    if (enchant != null)
                    {
                        enchantLvInfo = new ConfigCacheSet <EnchantLvInfo>().FindKey(enchant.EnchantID, userEnchantInfo.EnchantLv);
                        short         uplv      = MathUtils.Addition(userEnchantInfo.EnchantLv, (short)1, (short)GameConfigSet.MaxEnchantLv);
                        EnchantLvInfo enchantLv = new ConfigCacheSet <EnchantLvInfo>().FindKey(userEnchantInfo.EnchantID, uplv);
                        upExp = enchantLv == null ? 0 : enchantLv.Experience;
                    }
                }
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// 附魔
        /// </summary>
        public static bool ItemEnchant(this MainForm main, Item item, EnchantInfo attribute)
        {
            if (attribute == null || item == null)
            {
                return(false);
            }
            ItemClassInfo info = main.DataHelper.getItemClassInfo(item.ItemClass);

            if (info != null)
            {
                if (!(info.MainCategory == MainCategory.WEAPON ||
                      info.SubCategory == SubCategory.INNERARMOR ||
                      info.MainCategory == MainCategory.CLOTH ||
                      info.MainCategory == MainCategory.LIGHTARMOR ||
                      info.MainCategory == MainCategory.HEAVYARMOR ||
                      info.MainCategory == MainCategory.PLATEARMOR ||
                      info.MainCategory == MainCategory.ACCESSORY))
                {
                    if (!main.Question("该类型[" + info.MainCategory.Name() + "]不适合附魔,确定强制附魔?"))
                    {
                        return(false);
                    }
                }
            }

            ItemAttributeType type = attribute.IsPrefix ? ItemAttributeType.PREFIX : ItemAttributeType.SUFFIX;

            return(ModItemAttr(main, new ItemAttribute(type, attribute.Class).SetArg(attribute.MaxArg), item));
        }
예제 #3
0
        public EnchantInfo GetEnchant(string name)
        {
            if (name == null)
            {
                return(null);
            }
            name = name.ToLower();
            if (name.EndsWith("_100"))
            {
                name = name.Substring(0, name.Length - 4);
            }
            EnchantInfo info = new EnchantInfo();

            Enchants.TryGetValue(name, out info);
            return(info);
        }
예제 #4
0
 private void ReadEnchants(SQLiteHelper db, HeroesTextHelper HeroesText)
 {
     using (DbDataReader reader2 = db.GetReader("SELECT * FROM EnchantInfo ORDER BY EnchantLevel;"))
     {
         while (reader2 != null && reader2.Read())
         {
             EnchantInfo info = new EnchantInfo(reader2, HeroesText);
             if (info.Class.EndsWith("_100"))
             {
                 continue;
             }
             if (!Enchants.ContainsKey(info.Class))
             {
                 Enchants.Add(info.Class, info);
             }
         }
     }
 }
예제 #5
0
        /// <summary>
        /// 附魔
        /// </summary>
        public static bool ItemEnchant(this MainForm main, Item item, EnchantInfo attribute)
        {
            if (attribute == null || item == null)
            {
                return(false);
            }
            ItemClassInfo info = main.DataHelper.GetItemInfo(item.ItemClass);

            if (info != null)
            {
                if (!(info.MainCategory == MainCategory.WEAPON ||
                      info.SubCategory == SubCategory.INNERARMOR ||
                      info.MainCategory == MainCategory.CLOTH ||
                      info.MainCategory == MainCategory.LIGHTARMOR ||
                      info.MainCategory == MainCategory.HEAVYARMOR ||
                      info.MainCategory == MainCategory.PLATEARMOR ||
                      info.MainCategory == MainCategory.ACCESSORY))
                {
                    if (!main.Question("该类型[" + info.MainCategory.Name() + "]不适合附魔,确定强制附魔?"))
                    {
                        return(false);
                    }
                }
            }

            ItemAttributeType type = attribute.IsPrefix ? ItemAttributeType.PREFIX : ItemAttributeType.SUFFIX;

            return(ModItemAttr(main, new ItemAttribute(type, attribute.Class).SetArg(attribute.MaxArg), item));
//
//			if (db.ExcuteScalarSQL("SELECT COUNT(*) FROM ItemAttribute ia LEFT JOIN Item i ON i.ID = ia.ItemID"
//			                       + " WHERE (ia.Attribute = '" + name + "') AND i.ID =" + item.ItemID) == 0)
//			{
//				return db.ExcuteSQL(string.Concat(new object[] {
//				                                    "INSERT INTO ItemAttribute ([ItemID], [Attribute], [Value], [Arg], [Arg2]) VALUES (",
//				                                    item.ItemID, ", '"+name+"','", attribute.Class, "', '"+attribute.MaxArg+"', '0')" })) > 0;
//			}
//			else if (db.ExcuteSQL("UPDATE ItemAttribute SET [Value] ='"+ attribute.Class+ "',[Arg]='"+ attribute.MaxArg +
//			                      "' WHERE ItemID =" + item.ItemID+ " AND Attribute = '"+name+"'") > 0)
//			{
//				return true;
//			}
//			return false;
        }
예제 #6
0
        void SetEnchantTextBlock(EquipId item)
        {
            EnchantInfo enchant_info = Equip._enchant_db.Dic[item.Name_Eng];
            string      txt;

            if (enchant_info.IsAdvanced)
            {
                txt = enchant_info.NAME_KOR + " " + Convert.ToString(item.Point);
            }
            else
            {
                txt = enchant_info.NAME_KOR + " " + Convert.ToString(item.Point);
            }

            TextBlock PopupText = new TextBlock
            {
                Text       = txt,
                Background = Brushes.Silver
            };

            itemPopup.Child = PopupText;
        }
예제 #7
0
 private static void EnchantItem(MainForm main, EnchantInfo info, ListView listview)
 {
     if (info == null || listview == null)
     {
         return;
     }
     if (main.isMailListView())
     {
         Mail mail = listview.GetSelectItem <Mail>();
         if (mail != null)
         {
             string type      = (info.IsPrefix?ItemAttributeType.PREFIX:ItemAttributeType.SUFFIX).ToString();
             string itemclass = ModItemStringAttr(mail.ItemClassEx, type, "" + info.Class);
             if (main.Db.ModMailItem(mail, itemclass))
             {
                 main.log(mail.Title + " 附魔【" + info.Name + "】成功。");
                 main.ReadMails();
             }
             else
             {
                 main.log(mail.Title + " 附魔【" + info.Name + "】失败。");
             }
         }
     }
     else
     {
         Item item = listview.GetSelectItem <Item>();
         //附魔
         if (main.ItemEnchant(item, info))
         {
             main.log(item.Name + " 附魔【" + info.Name + "】成功。");
             main.ReadPackage(item.Package);
         }
         else
         {
             main.log(item.Name + " 附魔【" + info.Name + "】失败。");
         }
     }
 }
예제 #8
0
        public override bool TakeAction()
        {
            var package = UserEnchant.Get(ContextUser.UserID);

            if (package != null)
            {
                userEnchant = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID);
                if (userEnchant != null)
                {
                    matureNum   = (decimal)userEnchant.MaxMature / GameConfigSet.MaxEnchantMature;
                    maxMature   = CombatHelper.EnchantFinalNum(userEnchant);
                    enchantInfo = new ConfigCacheSet <EnchantInfo>().FindKey(userEnchant.EnchantID);
                    EnchantLvInfo enchantLvInfo = new ConfigCacheSet <EnchantLvInfo>().FindKey(userEnchant.EnchantID,
                                                                                               userEnchant.EnchantLv);
                    if (enchantLvInfo != null)
                    {
                        abilityNum = TrumpHelper.GetTransformData(enchantLvInfo.Num);
                    }
                }
            }
            enchantList = EnchantHelper.EnchantCultureList();
            return(true);
        }
예제 #9
0
    public void LoadLowData()
    {
        {
            TextAsset    data   = Resources.Load("TestJson/Enchant_Break", typeof(TextAsset)) as TextAsset;
            StringReader sr     = new StringReader(data.text);
            string       strSrc = sr.ReadToEnd();
            JSONObject   Break  = new JSONObject(strSrc);

            for (int i = 0; i < Break.list.Count; i++)
            {
                BreakInfo tmpInfo = new BreakInfo();
                tmpInfo.Id         = (uint)Break[i]["Id_ui"].n;
                tmpInfo.ItemIdx1   = (uint)Break[i]["ItemIdx1_ui"].n;
                tmpInfo.ItemValue1 = (ushort)Break[i]["ItemValue1_us"].n;
                tmpInfo.ItemIdx2   = (uint)Break[i]["ItemIdx2_ui"].n;
                tmpInfo.ItemValue2 = (ushort)Break[i]["ItemValue2_us"].n;
                tmpInfo.ItemIdx3   = (uint)Break[i]["ItemIdx3_ui"].n;
                tmpInfo.ItemValue3 = (ushort)Break[i]["ItemValue3_us"].n;

                BreakInfoDic.Add(tmpInfo.Id, tmpInfo);
            }
        }
        {
            TextAsset    data    = Resources.Load("TestJson/Enchant_Enchant", typeof(TextAsset)) as TextAsset;
            StringReader sr      = new StringReader(data.text);
            string       strSrc  = sr.ReadToEnd();
            JSONObject   Enchant = new JSONObject(strSrc);

            for (int i = 0; i < Enchant.list.Count; i++)
            {
                EnchantInfo tmpInfo = new EnchantInfo();
                tmpInfo.Id           = (uint)Enchant[i]["Id_ui"].n;
                tmpInfo.enchantCount = (byte)Enchant[i]["enchantCount_b"].n;
                tmpInfo.ItemIdx1     = (uint)Enchant[i]["ItemIdx1_ui"].n;
                tmpInfo.ItemValue1   = (uint)Enchant[i]["ItemValue1_ui"].n;
                tmpInfo.ItemIdx2     = (uint)Enchant[i]["ItemIdx2_ui"].n;
                tmpInfo.ItemValue2   = (uint)Enchant[i]["ItemValue2_ui"].n;
                tmpInfo.ItemIdx3     = (uint)Enchant[i]["ItemIdx3_ui"].n;
                tmpInfo.ItemValue3   = (uint)Enchant[i]["ItemValue3_ui"].n;
                tmpInfo.ItemIdx4     = (uint)Enchant[i]["ItemIdx4_ui"].n;
                tmpInfo.ItemValue4   = (uint)Enchant[i]["ItemValue4_ui"].n;
                tmpInfo.ItemIdx5     = (uint)Enchant[i]["ItemIdx5_ui"].n;
                tmpInfo.ItemValue5   = (uint)Enchant[i]["ItemValue5_ui"].n;
                tmpInfo.CostGold     = (uint)Enchant[i]["CostGold_ui"].n;

                EnchantInfoList.Add(tmpInfo);
            }
        }
        {
            TextAsset    data   = Resources.Load("TestJson/Enchant_Evolve", typeof(TextAsset)) as TextAsset;
            StringReader sr     = new StringReader(data.text);
            string       strSrc = sr.ReadToEnd();
            JSONObject   Evolve = new JSONObject(strSrc);

            for (int i = 0; i < Evolve.list.Count; i++)
            {
                EvolveInfo tmpInfo = new EvolveInfo();
                tmpInfo.evolveId    = (uint)Evolve[i]["evolveId_ui"].n;
                tmpInfo.evolveCount = (byte)Evolve[i]["evolveCount_b"].n;
                tmpInfo.ItemIdx1    = (uint)Evolve[i]["ItemIdx1_ui"].n;
                tmpInfo.ItemValue1  = (ushort)Evolve[i]["ItemValue1_us"].n;
                tmpInfo.ItemAdd1    = (byte)Evolve[i]["ItemAdd1_b"].n;
                tmpInfo.ItemIdx2    = (uint)Evolve[i]["ItemIdx2_ui"].n;
                tmpInfo.ItemValue2  = (ushort)Evolve[i]["ItemValue2_us"].n;
                tmpInfo.ItemAdd2    = (byte)Evolve[i]["ItemAdd2_b"].n;
                tmpInfo.ItemIdx3    = (uint)Evolve[i]["ItemIdx3_ui"].n;
                tmpInfo.ItemValue3  = (ushort)Evolve[i]["ItemValue3_us"].n;
                tmpInfo.ItemAdd3    = (byte)Evolve[i]["ItemAdd3_b"].n;
                tmpInfo.CostGold    = (uint)Evolve[i]["CostGold_ui"].n;
                tmpInfo.GoldAdd     = (uint)Evolve[i]["GoldAdd_ui"].n;

                EvolveInfoList.Add(tmpInfo);
            }
        }
    }
예제 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="main"></param>
        /// <param name="t"></param>
        /// <param name="info"></param>
        /// <param name="i">位置</param>
        /// <param name="listview"></param>
        /// <param name="selectindex">选择索引</param>
        /// <returns></returns>
        public static ListViewItem GetItemView(this MainForm main, Item t, int i, ListView listview, bool fullname, bool hascolor, bool has2category)
        {
            ListViewItem  vitem = new ListViewItem();
            ItemClassInfo info  = main.DataHelper.GetItemInfo(t.ItemClass);

            t.Attach(info);
            vitem.Tag  = t;
            vitem.Text = (t.ItemName == null ? t.ItemClass : t.ItemName);
            if (fullname && t.Attributes != null)
            {
                string head = "";
                foreach (ItemAttribute attr in t.Attributes)
                {
                    if (attr.Type == ItemAttributeType.ENHANCE)
                    {
                        head = "+" + attr.Value + " ";
                        break;
                    }
                }
                foreach (ItemAttribute attr in t.Attributes)
                {
                    if (attr.Type == ItemAttributeType.SYNTHESISGRADE)
                    {
                        head = "【" + attr.Value.Split('/')[0] + "】";
                        break;
                    }
                }
                foreach (ItemAttribute attr in t.Attributes)
                {
                    if (attr.Type == ItemAttributeType.PREFIX)
                    {
                        EnchantInfo einfo = main.DataHelper.GetEnchant(attr.Value);
                        head += "【" + (einfo == null ? attr.Value : einfo.Name) + "】";
                        break;
                    }
                }
                foreach (ItemAttribute attr in t.Attributes)
                {
                    if (attr.Type == ItemAttributeType.SUFFIX)
                    {
                        EnchantInfo einfo = main.DataHelper.GetEnchant(attr.Value);
                        head += "【" + (einfo == null ? attr.Value : einfo.Name) + "】";
                        break;
                    }
                }
                foreach (ItemAttribute attr in t.Attributes)
                {
                    if (attr.Type == ItemAttributeType.QUALITY)
                    {
                        head += "★" + attr.Arg + " ";
                        break;
                    }
                    else if (attr.Type == ItemAttributeType.VALUE)
                    {
                        vitem.Text = vitem.Text.Replace("{0}", attr.Value);
                    }
                }
                if (!string.IsNullOrEmpty(head))
                {
                    vitem.Text = head + vitem.Text;
                }
            }
            if (i % 2 == 0)
            {
                vitem.BackColor = Color.GhostWhite;
            }
            else
            {
                vitem.BackColor = Color.White;
            }
            vitem.SubItems.Add("" + t.Count);
            if (has2category)
            {
                vitem.SubItems.Add("" + t.MainCategory);
            }
            vitem.SubItems.Add("" + t.SubCategory);
            if (hascolor)
            {
                vitem.UseItemStyleForSubItems = false;
                int colorIndex = vitem.SubItems.Count;
                vitem.SubItems.Add(""); // + (t.Color1 == 0 ? "" : t.Color1.ToString("x")));
                vitem.SubItems.Add(""); // + (t.Color1 == 0 || t.Color2 == 0 ? "" : t.Color2.ToString("x")));
                vitem.SubItems.Add(""); // + (t.Color1 == 0 || t.Color3 == 0 ? "" : t.Color3.ToString("x")));
                vitem.SubItems[colorIndex].BackColor     = t.Color1.GetColor();
                vitem.SubItems[colorIndex + 1].BackColor = t.Color2.GetColor();
                vitem.SubItems[colorIndex + 2].BackColor = t.Color3.GetColor();
                vitem.SubItems[colorIndex].ForeColor     = vitem.SubItems[colorIndex].BackColor;
                vitem.SubItems[colorIndex + 1].ForeColor = vitem.SubItems[colorIndex + 1].BackColor;
                vitem.SubItems[colorIndex + 2].ForeColor = vitem.SubItems[colorIndex + 2].BackColor;
            }
            vitem.SubItems.Add("" + t.Time);
            vitem.ToolTipText = t.ToString();
            return(vitem);
        }