private void PunishBless(ref int index)
 {
     if (config.PunishBlessLevel > 0)
     {
         var blessId = BlessBook.GetRandomBlessLevel(false, config.PunishBlessLevel);
         BlessManager.AddBless(blessId, GameConstants.QuestBlessTime);
         vRegion.AddRegion(new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25,
                                             60, 60, PictureRegionCellType.Bless, blessId));
         index++;
     }
 }
Example #2
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();
        }
Example #3
0
        public static void ParseCommand(string cmd)
        {
            string[] data = cmd.Split(' ');
            if (data.Length == 0)
            {
                return;
            }
            try
            {
                switch (data[0])
                {
                case "exp": if (data.Length == 2)
                    {
                        UserProfile.InfoBasic.AddExp(int.Parse(data[1]));
                    }
                    break;

                case "cad": if (data.Length == 2)
                    {
                        UserProfile.InfoCard.AddCard(int.Parse(data[1]));
                    }
                    break;

                case "atp": if (data.Length == 2)
                    {
                        UserProfile.InfoBasic.AttrPoint += int.Parse(data[1]);
                    }
                    break;

                case "mov": if (data.Length == 2)
                    {
                        UserProfile.InfoBasic.Position = 0;                              //如果是0,后面流程会随机一个位置
                    }
                    Scene.Instance.ChangeMap(int.Parse(data[1]), true); break;

                case "eqp": if (data.Length == 2)
                    {
                        UserProfile.InfoEquip.AddEquip(int.Parse(data[1]), 60);
                    }
                    break;

                case "itm": if (data.Length == 3)
                    {
                        UserProfile.InfoBag.AddItem(int.Parse(data[1]), int.Parse(data[2]));
                    }
                    break;

                case "emys": foreach (int peopleId in ConfigData.PeopleDict.Keys)
                    {
                        DbRivalState memRival = new DbRivalState(peopleId);
                        memRival.Avail = true;
                        UserProfile.InfoRival.Rivals[peopleId] = memRival;
                    }
                    break;

                case "gold": if (data.Length == 2)
                    {
                        GameResource res = new GameResource();
                        res.Gold = int.Parse(data[1]);
                        UserProfile.InfoBag.AddResource(res.ToArray());
                    }
                    break;

                case "res": if (data.Length == 2)
                    {
                        int v = int.Parse(data[1]);
                        UserProfile.InfoBag.AddResource(new int[] { 0, v, v, v, v, v, v });
                    }
                    break;

                case "dmd": if (data.Length == 2)
                    {
                        UserProfile.InfoBag.AddDiamond(int.Parse(data[1]));
                    }
                    break;

                case "acv": if (data.Length == 2)
                    {
                        UserProfile.Profile.InfoAchieve.SetAchieve(int.Parse(data[1]));
                    }
                    break;

                case "view": if (data.Length == 3)
                    {
                        PeopleBook.ViewMatch(int.Parse(data[1]), int.Parse(data[2]), "default", TileConfig.Indexer.DefaultTile);
                    }
                    break;

                case "fbat": if (data.Length == 3)
                    {
                        FastBattle.Instance.StartGame(int.Parse(data[1]), int.Parse(data[2]), "default", TileConfig.Indexer.DefaultTile);
                        MainTipManager.AddTip(string.Format("{0} {1}合", FastBattle.Instance.LeftWin ? "左胜" : "右胜", BattleManager.Instance.StatisticData.Round), "White");
                    }
                    break;

                case "cbat":
                    if (data.Length == 4)
                    {
                        var result = CardFastBattle.Instance.StartGame(int.Parse(data[1]), int.Parse(data[2]), int.Parse(data[3]));
                        MainTipManager.AddTip(string.Format("{0} {1}合", result, BattleManager.Instance.StatisticData.Round), "White");
                    }
                    break;

                case "scr": if (data.Length == 2)
                    {
                        switch (data[1])
                        {
                        case "Vs": GmScript.MonsterVsBatch(); break;
                        }
                    }
                    break;

                case "sceq":
                    NpcTalkForm sw = new NpcTalkForm();
                    sw.EventId       = int.Parse(data[1]);
                    sw.NeedBlackForm = true;
                    PanelManager.DealPanel(sw); break;

                case "cure": UserProfile.InfoBasic.MentalPoint = 100; UserProfile.InfoBasic.HealthPoint = 100;
                    UserProfile.InfoBasic.FoodPoint            = 100; break;

                case "bls": if (data.Length == 2)
                    {
                        BlessManager.AddBless(int.Parse(data[1]), 10);
                    }
                    break;

                case "qst": if (data.Length == 2)
                    {
                        UserProfile.InfoQuest.SetQuest(int.Parse(data[1]));
                    }
                    break;
                }
            }
            catch (FormatException) { }
            catch (IndexOutOfRangeException) { }
        }