private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            int level = UserProfile.InfoSkill.GetSkillAttrLevel(sid);
            int cost  = HeroSkillAttrBook.GetCost(sid, level + 1);

            if (level >= UserProfile.InfoBasic.Level)
            {
                parent.AddFlowCenter("等级限制", "Red");
                return;
            }

            if (UserProfile.InfoBasic.AttrPoint >= cost)
            {
                UserProfile.InfoBasic.AttrPoint -= cost;
                UserProfile.InfoSkill.AddSkillAttrLevel(sid);

                if (level + 1 >= UserProfile.InfoBasic.Level)
                {
                    bitmapButtonBuy.Visible = false;
                }
                parent.Invalidate();
            }
            else
            {
                parent.AddFlowCenter("阅历不足", "Red");
            }
        }
Beispiel #2
0
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            if (UserProfile.InfoBag.GetBlankCount() <= 0)
            {
                parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagIsFull), "Red");
                return;
            }

            var  gameShopConfig = ConfigData.GetGameShopConfig(productId);
            var  eid            = HItemBook.GetItemId(gameShopConfig.Item);
            var  itmConfig      = ConfigData.GetHItemConfig(eid);
            var  goldPrice      = GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor) * 2;
            bool buyFin         = false;

            if (gameShopConfig.UseDiamond)
            {
                var diamondPrice = (int)Math.Max(1, goldPrice / GameConstants.DiamondToGold);
                if (UserProfile.InfoBag.PayDiamond(diamondPrice))
                {
                    UserProfile.InfoBag.AddItem(eid, 1);
                    buyFin = true;
                }
                else
                {
                    parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughDimond), "Red");
                }
            }
            else
            {
                if (UserProfile.InfoBag.HasResource(GameResourceType.Gold, goldPrice))
                {
                    UserProfile.InfoBag.SubResource(GameResourceType.Gold, goldPrice);
                    UserProfile.InfoBag.AddItem(eid, 1);
                    buyFin = true;
                }
                else
                {
                    parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughResource), "Red");
                }
            }

            if (buyFin)
            {
                parent.AddFlowCenter("+1", "Lime", HItemBook.GetHItemImage(eid));
            }
            //PopBuyProduct.Show(eid, (int)Math.Max(1, itemPrice / GameConstants.DiamondToGold));
        }
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            var equipConfig = ConfigData.GetEquipConfig(equipId);
            var cost        = GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level);

            if (UserProfile.InfoBag.HasResource(GameResourceType.Stone, cost))
            {
                UserProfile.InfoBag.SubResource(GameResourceType.Stone, cost);
                UserProfile.InfoEquip.AddEquip(equipId, 60 * 3);
                parent.Invalidate();

                parent.AddFlowCenter("锻造成功", "Lime");
            }
            else
            {
                parent.AddFlowCenter("资源不足", "Red");
            }
        }
Beispiel #4
0
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            if (UserProfile.InfoBag.Resource.Gold >= price)
            {
                UserProfile.InfoBag.Resource.Gold -= price;
                UserProfile.InfoBag.AddItem(itemId, itemCount);
                (parent as BuyPieceForm).RemovePieceData(index);

                RefreshData();
            }
            else
            {
                parent.AddFlowCenter("金钱不足", "Red");
            }
        }
Beispiel #5
0
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            var  config = ConfigData.GetBlessConfig(blessId);
            uint cost   = 0;

            if (config.Type == 1) //买入
            {
                cost = GameResourceBook.OutMercuryBlessBuy(config.Level);
            }
            else
            {
                cost = GameResourceBook.OutMercuryBlessBuy(config.Level);
            }

            if (!UserProfile.InfoBag.HasResource(GameResourceType.Mercury, cost))
            {
                parent.AddFlowCenter("资源不足", "Red");
                return;
            }

            UserProfile.InfoBag.SubResource(GameResourceType.Mercury, cost);
            if (config.Type == 1) //买入
            {
                BlessManager.AddBless(blessId, GameConstants.QuestBlessTime);
                UserProfile.InfoWorld.BlessShopItems.Remove(blessId);
                parent.AddFlowCenter("祝福成功", "Lime");
            }
            else
            {
                BlessManager.RemoveBless(blessId);
                parent.AddFlowCenter("移除成功", "Lime");
            }

            (parent as BlessForm).RefreshPage();
            parent.Invalidate();
        }
Beispiel #6
0
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            if (!UserProfile.InfoBag.HasResource((GameResourceType)priceType, (uint)price))
            {
                parent.AddFlowCenter("资源不足", "Red");
                return;
            }

            UserProfile.InfoBag.SubResource((GameResourceType)priceType, (uint)price);
            var isEquip = ConfigIdManager.IsEquip(itemId);

            if (!isEquip)
            {
                UserProfile.InfoBag.AddItem(itemId, 1);
            }
            else
            {
                UserProfile.InfoEquip.AddEquip(itemId, 0);
            }
        }
Beispiel #7
0
 private void virtualRegion_RegionClicked(int info, int tx, int ty, MouseButtons button)
 {
     if (info == 2 && product.Id > 0)
     {
         GameResource res = product.Price;
         if (UserProfile.InfoBag.CheckResource(res.ToArray()))
         {
             UserProfile.InfoCard.AddCard(product.Cid);
             UserProfile.InfoBag.SubResource(res.ToArray());
             UserProfile.InfoWorld.RemoveCardProduct(product.Cid);
             CardShopViewForm cardShopViewForm = parent as CardShopViewForm;
             if (cardShopViewForm != null)
             {
                 cardShopViewForm.ChangeShop();
             }
         }
         else
         {
             parent.AddFlowCenter("没有足够的资源!", "Red");
         }
     }
 }