Exemplo n.º 1
0
        private void CalculateRequire()
        {
            int index = 1;

            winRate        = config.ChooseWinRate * (10 - hardness) / 10;
            rollItemSpeedX = MathTool.GetRandom(40, 70);

            if (config.ChooseFood > 0)
            {
                int foodCost = (int)GameResourceBook.OutFoodSceneQuest(config.ChooseFood, true);
                var region   = ComplexRegion.GetResButtonRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25 + 70), 60, ImageRegionCellType.Food, -foodCost);
                region.Parm = ImageRegionCellType.Food;
                vRegion.AddRegion(region);
                index++;
            }

            if (config.ChooseGold > 0)
            {
                int goldCost = (int)GameResourceBook.OutGoldSceneQuest(level, config.ChooseGold, true);
                var region   = ComplexRegion.GetResButtonRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25 + 70), 60, ImageRegionCellType.Gold, -goldCost);
                region.Parm = ImageRegionCellType.Gold;
                vRegion.AddRegion(region);
                index++;
            }

            var button = new ButtonRegion(20, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25 + 70, 60, 60, "iconbg.jpg", "");

            button.AddDecorator(new RegionImageDecorator(HSIcons.GetIconsByEName("rot7"), 60 / 2));
            vRegion.AddRegion(button);
        }
Exemplo n.º 2
0
        public void RefreshData(int id)
        {
            bitmapButtonBuy.Visible = id != 0;
            show   = id != 0;
            itemId = id;
            if (id != 0)
            {
                var isEquip = ConfigIdManager.IsEquip(id);
                virtualRegion.SetRegionKey(1, id);
                virtualRegion.SetRegionType(1, !isEquip ? PictureRegionCellType.Item : PictureRegionCellType.Equip);
                if (!isEquip)
                {
                    var itmConfig = ConfigData.GetHItemConfig(itemId);
                    price = (int)GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor);
                }
                else
                {
                    price = ConfigData.GetEquipConfig(itemId).Value;
                }
            }

            if (priceType > 0) //非金币购买
            {
                price = price / 10 + 1;
            }

            parent.Invalidate(new Rectangle(x, y, width, height));
        }
Exemplo n.º 3
0
        private void OnStop()
        {
            if (result == null)
            {
                RunningState = TalkEventState.Finish;
                int frameSize = (pos.Width - 20) / evt.ParamList.Count;
                result = evt.ChooseTarget(rollItemX / frameSize);

                if (BlessManager.RollFailSubHealth > 0 && evt.ParamList[rollItemX / frameSize].Contains("失败"))
                {
                    var healthSub = GameResourceBook.OutHealthSceneQuest(BlessManager.RollFailSubHealth * 100);
                    if (healthSub > 0)
                    {
                        UserProfile.Profile.InfoBasic.SubHealth(healthSub);
                    }
                }
                if (BlessManager.RollWinAddGold > 0 && evt.ParamList[rollItemX / frameSize].Contains("成功"))
                {
                    var goldAdd = GameResourceBook.InGoldSceneQuest(level, BlessManager.RollWinAddGold * 100);
                    if (goldAdd > 0)
                    {
                        UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gold, goldAdd);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void Draw(Graphics g)
        {
            SolidBrush sb = new SolidBrush(Color.FromArgb(20, 20, 20));

            g.FillRectangle(sb, x + 2, y + 2, width - 4, height - 4);
            sb.Dispose();
            g.DrawRectangle(Pens.Teal, x + 2, y + 2, width - 4, height - 4);

            if (show)
            {
                var equipConfig = ConfigData.GetEquipConfig(equipId);

                virtualRegion.Draw(g);

                var   cost = GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level);
                Font  ft   = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                Brush b    = new SolidBrush(Color.FromName(HSTypes.I2QualityColor(equipConfig.Quality)));
                g.DrawString(equipConfig.Name, ft, b, x + 90, y + 10);
                b.Dispose();
                g.DrawString(string.Format("{0}", cost), ft, Brushes.White, x + 90 + 20, y + 32);
                ft.Dispose();

                g.DrawImage(HSIcons.GetIconsByEName("res3"), x + 90, y + 32 - 3, 18, 18);
            }
        }
Exemplo n.º 5
0
        private void buttonBuy_Click(object sender, EventArgs e)
        {
            if (selectPanel.SelectIndex < 0)
            {
                return;
            }

            EquipConfig equipConfig = ConfigData.GetEquipConfig(currentInfo.Target);

            foreach (IntPair pairValue in currentInfo.Methods)
            {
                if (UserProfile.InfoBag.GetItemCount(pairValue.Type) < pairValue.Value)
                {
                    AddFlowCenter("合成材料不足", "Red");
                    return;
                }
            }
            if (UserProfile.InfoBag.HasResource(GameResourceType.Stone, GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level)))
            {
                AddFlowCenter("石材不足", "Red");
                return;
            }

            DoMerge();
            UpdateMethod();
        }
Exemplo n.º 6
0
        private void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            if (!vRegion.Visible)
            {
                return;
            }

            var region = vRegion.GetRegion(id);

            if (region != null && region.Parm != null)
            {
                var regionType = (ImageRegionCellType)region.Parm;
                if (regionType == ImageRegionCellType.Gold)
                {
                    int    goldCost = (int)GameResourceBook.OutGoldSceneQuest(level, config.ChooseGold, true);
                    string resStr   = string.Format("消耗{0}黄金,{1}%成功率(+{2}%)", goldCost, winRate + config.ChooseGoldAddon, config.ChooseGoldAddon);
                    Image  image    = DrawTool.GetImageByString(resStr, 100);
                    tooltip.Show(image, parent, x, y);
                }
                else if (regionType == ImageRegionCellType.Food)
                {
                    int    foodCost = (int)GameResourceBook.OutFoodSceneQuest(config.ChooseFood, true);
                    string resStr   = string.Format("消耗{0}食物,{1}%成功率(+{2}%)", foodCost, winRate + config.ChooseFoodAddon, config.ChooseFoodAddon);
                    Image  image    = DrawTool.GetImageByString(resStr, 100);
                    tooltip.Show(image, parent, x, y);
                }
            }

            if (id == 20)
            {
                tooltip.Show(string.Format("不追加,{0}%成功率", winRate), parent, x, y);
            }
        }
Exemplo n.º 7
0
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId);
            var            itmConfig      = ConfigData.GetHItemConfig(gameShopConfig.ItemId);
            var            itemPrice      = GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor);

            PopBuyProduct.Show(gameShopConfig.ItemId, (int)Math.Max(1, itemPrice / GameConstants.DiamondToGold));
        }
Exemplo n.º 8
0
        private void MergeWeaponForm_Paint(object sender, PaintEventArgs e)
        {
            BorderPainter.Draw(e.Graphics, "", Width, Height);

            Font font = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);

            e.Graphics.DrawString(" 试炼 ", font, Brushes.White, Width / 2 - 40, 8);
            font.Dispose();

            if (currentInfo == null)
            {
                return;
            }

            font = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
            e.Graphics.DrawString(timeText, font, Brushes.YellowGreen, 165, 412);
            font.Dispose();

            int         targetid    = selectPanel.SelectInfo;
            EquipConfig equipConfig = ConfigData.GetEquipConfig(targetid);

            font = new Font("微软雅黑", 14 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
            e.Graphics.DrawString((GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level)).ToString().PadLeft(5, ' '), font, PaintTool.GetBrushByResource((int)GameResourceType.Mercury), 273, 368);
            e.Graphics.DrawImage(HSIcons.GetIconsByEName("res3"), 333, 370, 24, 24);
            font.Dispose();

            font = new Font("微软雅黑", 10 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);

            int[] imgOff = { 200, 410, 270, 340 };
            int   index  = 1;

            foreach (var pair in currentInfo.Methods)
            {
                var   imgOffX = imgOff[index - 1];
                Brush brush   = new SolidBrush(Color.FromName(HSTypes.I2RareColor(ConfigData.GetHItemConfig(pair.Type).Rare)));
                e.Graphics.DrawString(ConfigData.GetHItemConfig(pair.Type).Name, font, brush, imgOffX, 305);
                brush.Dispose();

                var  itemCount = itemCounts[index];
                bool isEnough  = itemCount >= pair.Value;
                e.Graphics.DrawString(string.Format("{0}/{1}", itemCount, pair.Value), font, isEnough ? Brushes.Lime : Brushes.Red, imgOffX, 325);

                e.Graphics.DrawLine(isEnough ? Pens.Lime : Pens.Gray, 325, 160, imgOffX + 20, 295);

                index++;
            }
            font.Dispose();

            Image border = PicLoader.Read("Border", "itemb1.PNG");

            e.Graphics.DrawImage(border, 295 - 10, 100 - 15, 80, 90);
            border.Dispose();

            virtualRegion.Draw(e.Graphics);
        }
Exemplo n.º 9
0
        private void PunishMental(ref int index)
        {
            var mentalLoss = (uint)(GameResourceBook.OutMentalSceneQuest(config.PunishMental) * (10 + hardness) / 10);

            if (mentalLoss > 0)
            {
                UserProfile.Profile.InfoBasic.SubMental(mentalLoss);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Mental, (int)-mentalLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 10
0
        private void DoMerge()
        {
            EquipConfig equipConfig = ConfigData.GetEquipConfig(currentInfo.Target);

            UserProfile.InfoBag.SubResource(GameResourceType.Stone, GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level));
            foreach (IntPair pairValue in currentInfo.Methods)
            {
                UserProfile.InfoBag.DeleteItem(pairValue.Type, pairValue.Value);
            }

            UserProfile.InfoEquip.AddEquip(equipConfig.Id, 60 * 3);
            UserProfile.InfoEquip.AddEquipCompose(equipConfig.Id);
        }
Exemplo n.º 11
0
        public void SellItemAllByPos(int pos)
        {
            var pickItem = Items[pos];

            if (pickItem.Type > 0 && pickItem.Value > 0)
            {
                var  config    = ConfigData.GetHItemConfig(pickItem.Type);
                uint sellPrice = GameResourceBook.InGoldSellItem(config.Rare, config.ValueFactor);
                uint money     = (uint)(sellPrice * pickItem.Value);
                AddResource(GameResourceType.Gold, money);
            }
            ClearItemAllByPos(pos);
        }
Exemplo n.º 12
0
        private void RewardExp(ref int index)
        {
            var expGet = (uint)(GameResourceBook.InExpSceneQuest(level, config.RewardExp) * (10 + hardness) / 10); //难度越高经验越多

            if (expGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddExp((int)expGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Exp, (int)expGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 13
0
        private void PunishGold(ref int index)
        {
            var goldLoss = GameResourceBook.OutGoldSceneQuest(level, config.PunishGold);

            if (goldLoss > 0)
            {
                UserProfile.Profile.InfoBag.SubResource(GameResourceType.Gold, goldLoss);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Gold, (int)-goldLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 14
0
        private void RewardGold(ref int index)
        {
            var goldGet = (uint)(GameResourceBook.InGoldSceneQuest(level, config.RewardGold) * (10 + hardness) / 10); //难度越高资源越多

            if (goldGet > 0)
            {
                UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gold, goldGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Gold, (int)goldGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 15
0
        private void RewardHealth(ref int index)
        {
            var healthGet = GameResourceBook.InHealthSceneQuest(config.RewardHealth);

            if (healthGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddHealth(healthGet);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Health, (int)healthGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 16
0
        private void RewardFood(ref int index)
        {
            var foodGet = (uint)(GameResourceBook.InFoodSceneQuest(config.RewardFood) * (10 - hardness) / 10);

            if (foodGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddFood(foodGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Food, (int)foodGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 17
0
        private void PunishHealth(ref int index)
        {
            var healthLoss = GameResourceBook.OutHealthSceneQuest(config.PunishHealth);

            if (healthLoss > 0)
            {
                UserProfile.Profile.InfoBasic.SubHealth(healthLoss);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Health, (int)-healthLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 18
0
        private void PunishFood(ref int index)
        {
            var foodLoss = GameResourceBook.OutFoodSceneQuest(config.PunishFood);

            if (foodLoss > 0)
            {
                UserProfile.Profile.InfoBasic.SubFood(foodLoss);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Food, (int)-foodLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 19
0
        private void RewardMental(ref int index)
        {
            var mentalGet = GameResourceBook.InMentalSceneQuest(config.RewardMental);

            if (mentalGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddMental(mentalGet);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Mental, (int)mentalGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 20
0
        public static Image GetPreview(int id)
        {
            HItemConfig hItemConfig = ConfigData.GetHItemConfig(id);

            if (hItemConfig.Id <= 0)
            {
                return(DrawTool.GetImageByString("unknown", 100));
            }

            ControlPlus.TipImage tipData = new ControlPlus.TipImage(PaintTool.GetTalkColor);
            tipData.AddTextNewLine(hItemConfig.Name, HSTypes.I2RareColor(hItemConfig.Rare), 20);
            if (hItemConfig.IsUsable)
            {
                if (hItemConfig.SubType == (int)HItemTypes.Fight)
                {
                    tipData.AddTextNewLine("       战斗中双击使用", "Red");
                }
                else if (hItemConfig.SubType == (int)HItemTypes.Seed)
                {
                    tipData.AddTextNewLine("       农场中双击使用", "Red");
                }
                else
                {
                    tipData.AddTextNewLine("       双击使用", "Green");
                }
            }
            if (hItemConfig.Type == (int)HItemTypes.Task)
            {
                tipData.AddTextNewLine("       任务物品", "DarkBlue");
            }
            else if (hItemConfig.Type == (int)HItemTypes.Material)
            {
                tipData.AddTextNewLine(string.Format("       材料(稀有度:{0})", hItemConfig.Rare), "White");
            }
            if (hItemConfig.Attributes != null && hItemConfig.Attributes.Length > 0)
            {
                tipData.AddTextNewLine(string.Format("       特性:{0}", string.Join(",", hItemConfig.Attributes)), "Lime");
            }

            tipData.AddTextNewLine(string.Format("       等级:{0}", hItemConfig.Level), "White");
            tipData.AddTextNewLine("", "White", 8);
            if (!string.IsNullOrEmpty(hItemConfig.Descript))
            {
                tipData.AddTextLines(hItemConfig.Descript, "White", 20, true);
            }
            tipData.AddTextNewLine(string.Format("出售价格:{0}", GameResourceBook.InGoldSellItem(hItemConfig.Rare, hItemConfig.ValueFactor)), "Yellow");
            tipData.AddImage(HSIcons.GetIconsByEName("res1"));
            tipData.AddImageXY(GetHItemImage(id), 8, 8, 48, 48, 7, 24, 32, 32);

            return(tipData.Image);
        }
Exemplo n.º 21
0
        private void RewardRes(ref int index)
        {
            var resId  = config.RewardResId;
            var resGet = (uint)(GameResourceBook.InResSceneQuest(resId, level, config.RewardResAmount) * (10 + hardness) / 10); //难度越高资源越多

            if (resGet > 0)
            {
                UserProfile.Profile.InfoBag.AddResource((GameResourceType)resId, resGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Lumber + resId - 1, (int)resGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Exemplo n.º 22
0
        protected override void OnClick(MenuItemData target)
        {
            if (target.Type == "decompose")
            {
                var equipConfig = ConfigDatas.ConfigData.GetEquipConfig(UserProfile.InfoEquip.Equipoff[EquipIndex].BaseId);
                MainTipManager.AddTip(string.Format("|分解装备-|{0}|{1}", HSTypes.I2QualityColor(equipConfig.Quality), equipConfig.Name), "White");
                UserProfile.Profile.InfoBag.AddResource(GameResourceType.Stone, GameResourceBook.InStoneEquipDecompose(equipConfig.Quality, equipConfig.Level));

                UserProfile.InfoEquip.Equipoff[EquipIndex] = new DbEquip();
            }
            else
            {
                return;
            }
            Form.MenuRefresh(EquipIndex);
        }
Exemplo n.º 23
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));
        }
Exemplo n.º 24
0
        private void FarmForm_MouseClick(object sender, MouseEventArgs e)
        {
            int newsel = GetSelectedCell(e.X, e.Y);

            if (newsel != -1)
            {
                DbFarmState timeState = UserProfile.Profile.InfoFarm.GetFarmState(newsel);
                if (timeState.Type == -1)
                {
                    var pricecount = GameResourceBook.OutWoodBuildFarm(
                        (uint)UserProfile.Profile.InfoFarm.GetFarmAvailCount() * 20);
                    if (MessageBoxEx2.Show(string.Format("是否花{0}木材开启额外农田?", pricecount)) == DialogResult.OK)
                    {
                        if (UserProfile.InfoBag.HasResource(GameResourceType.Lumber, pricecount))
                        {
                            UserProfile.InfoBag.SubResource(GameResourceType.Lumber, pricecount);
                            UserProfile.Profile.InfoFarm.SetFarmState(newsel, new DbFarmState(0, 0));
                        }
                        else
                        {
                            AddFlowCenter("资源不足", "Red");
                        }
                    }
                }
                else if (timeState.Type > 0)
                {
                    if (timeState.Time < TimeTool.DateTimeToUnixTime(DateTime.Now))
                    {
                        UserProfile.InfoBag.AddItem(timeState.Type, 1);
                        UserProfile.Profile.InfoFarm.SetFarmState(newsel, new DbFarmState(0, 0));
                    }
                    else
                    {
                        int pricecount = (timeState.Time - TimeTool.DateTimeToUnixTime(DateTime.Now)) / 600 + 1;
                        if (MessageBoxEx2.Show(string.Format("是否花{0}钻石催熟作物?", pricecount)) == DialogResult.OK)
                        {
                            if (UserProfile.InfoBag.PayDiamond(pricecount))
                            {
                                UserProfile.Profile.InfoFarm.SetFarmState(newsel, new DbFarmState(timeState.Type, 0));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 25
0
        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");
            }
        }
Exemplo n.º 26
0
        private void OnFail()
        {
            result     = evt.ChooseTarget(0);
            isEndFight = true;

            if (BlessManager.FightFailSubHealth > 0)
            {
                var healthSub = GameResourceBook.OutHealthSceneQuest(BlessManager.FightFailSubHealth * 100);
                if (healthSub > 0)
                {
                    UserProfile.Profile.InfoBasic.SubHealth(healthSub);
                }
            }
            if (BlessManager.FightFailSubMental > 0)
            {
                var mentalSub = GameResourceBook.OutMentalSceneQuest(BlessManager.FightFailSubMental * 100);
                if (mentalSub > 0)
                {
                    UserProfile.Profile.InfoBasic.SubMental(mentalSub);
                }
            }
        }
Exemplo n.º 27
0
        private void virtualRegion_RegionClicked(int id, int x, int y, MouseButtons button)
        {
            if (!vRegion.Visible)
            {
                return;
            }

            tooltip.Hide(parent);

            var region = vRegion.GetRegion(id);

            if (region != null && region.Parm != null)
            {
                var regionType = (ImageRegionCellType)region.Parm;
                if (regionType == ImageRegionCellType.Gold)
                {
                    uint goldCost = GameResourceBook.OutGoldSceneQuest(level, config.ChooseGold, true);
                    if (!UserProfile.InfoBag.HasResource(GameResourceType.Gold, goldCost))
                    {
                        return;
                    }
                    UserProfile.InfoBag.SubResource(GameResourceType.Gold, goldCost);
                    winRate += config.ChooseGoldAddon;
                }
                else if (regionType == ImageRegionCellType.Food)
                {
                    uint foodCost = GameResourceBook.OutFoodSceneQuest(config.ChooseFood, true);
                    if (UserProfile.InfoBasic.FoodPoint < foodCost)
                    {
                        return;
                    }
                    UserProfile.InfoBasic.SubFood(foodCost);
                    winRate += config.ChooseFoodAddon;
                }
            }

            afterChoose     = true;
            vRegion.Visible = false;
        }
Exemplo n.º 28
0
        public void RemoveCardPiece(int id, bool returnResource)
        {
            DbDeckCard dc;

            if (Cards.TryGetValue(id, out dc))
            {
                if (dc.Exp == 0)
                {
                    return;
                }

                if (returnResource)
                {
                    var cardData = CardConfigManager.GetCardConfig(dc.BaseId);
                    MainTipManager.AddTip(string.Format("|分解卡片-|{0}|{1}", HSTypes.I2QualityColor(cardData.Quality), cardData.Name), "White");
                    int qual = CardConfigManager.GetCardConfig(dc.BaseId).Quality + 1;
                    UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gem, GameResourceBook.OutGemCardDecompose(qual));
                }

                dc.Exp--;
            }
        }
Exemplo n.º 29
0
        private void OnWin()
        {
            result     = evt.ChooseTarget(1);
            isEndFight = true;

            if (BlessManager.FightWinAddHealth > 0)
            {
                var healthAdd = GameResourceBook.InHealthSceneQuest(BlessManager.FightWinAddHealth * 100);
                if (healthAdd > 0)
                {
                    UserProfile.Profile.InfoBasic.AddHealth(healthAdd);
                }
            }
            if (BlessManager.FightWinAddExp > 0)
            {
                var expAdd = GameResourceBook.InExpSceneQuest(level, BlessManager.FightWinAddExp * 100);
                if (expAdd > 0)
                {
                    UserProfile.Profile.InfoBasic.AddExp((int)expAdd);
                }
            }
        }
Exemplo n.º 30
0
        public void Draw(Graphics g)
        {
            Image back = PicLoader.Read("System", "ShopItemBack.JPG");

            g.DrawImage(back, x, y, width - 1, height - 1);
            back.Dispose();

            if (show)
            {
                GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId);
                string         name;
                string         fontcolor;
                var            isEquip = ConfigIdManager.IsEquip(gameShopConfig.ItemId);
                if (!isEquip)
                {
                    HItemConfig itemConfig = ConfigData.GetHItemConfig(gameShopConfig.ItemId);
                    name      = itemConfig.Name;
                    fontcolor = HSTypes.I2RareColor(itemConfig.Rare);
                }
                else
                {
                    EquipConfig equipConfig = ConfigData.GetEquipConfig(gameShopConfig.ItemId);
                    name      = equipConfig.Name;
                    fontcolor = HSTypes.I2QualityColor(equipConfig.Quality);
                }
                Font  fontsong = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                Brush brush    = new SolidBrush(Color.FromName(fontcolor));
                g.DrawString(name, fontsong, brush, x + 76, y + 9);
                brush.Dispose();
                var itmConfig = ConfigData.GetHItemConfig(gameShopConfig.ItemId);
                var price     = GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor);
                g.DrawString(string.Format("{0,3:D}", Math.Max(1, price / GameConstants.DiamondToGold)), fontsong, Brushes.PaleTurquoise, x + 80, y + 37);
                fontsong.Dispose();
                g.DrawImage(HSIcons.GetIconsByEName("res8"), x + 110, y + 35, 16, 16);

                virtualRegion.Draw(g);
            }
        }