public void Effect(Forms.BasePanel panel, HsActionCallback success, HsActionCallback fail) { if (type == "item") { UserProfile.InfoBag.AddItem(infos[0], 1); HItemConfig itemConfig = ConfigData.GetHItemConfig(infos[0]); panel.AddFlowCenter(string.Format("获得{0}x1", itemConfig.Name), HSTypes.I2RareColor(itemConfig.Rare)); } else if (type == "mon") { PeopleBook.Fight(infos[0], "oneline", mlevel + infos[1], new PeopleFightParm(), success, fail, null); return; } else if (type == "gold") { UserProfile.InfoBag.AddResource(GameResourceType.Gold, (uint)infos[0]); panel.AddFlowCenter(string.Format("获得黄金x{0}", infos[0]), HSTypes.I2ResourceColor(0)); } else if (type == "resource") { UserProfile.InfoBag.AddResource((GameResourceType)(infos[0] - 1), 1); panel.AddFlowCenter(string.Format("获得{1}x{0}", 1, HSTypes.I2Resource(infos[0] - 1)), HSTypes.I2ResourceColor(infos[0] - 1)); } string word = MazeItemConfig.Word; if (word != "") { panel.AddFlowCenter(word, "White"); } success(); }
public void CheckAllTournament(int day) { foreach (var tournamentConfig in ConfigData.TournamentDict.Values) { if (tournamentConfig.ApplyDate == day) { DbTournamentData tourdata = GetTournamentData(tournamentConfig.Id); tourdata.Pids = PeopleBook.GetRandNPeople(tournamentConfig.PlayerCount, tournamentConfig.MinLevel, tournamentConfig.MaxLevel); if (tourdata.Engage) { tourdata.Pids[MathTool.GetRandom(tournamentConfig.PlayerCount)] = -1; //player } tourdata.Results = new MatchResult[tournamentConfig.MaxLevel]; } if (tournamentConfig.BeginDate <= day && tournamentConfig.EndDate >= day) { foreach (int mid in TournamentBook.GetTournamentMatchIds(tournamentConfig.Id)) { TournamentMatchConfig tournamentMatchConfig = ConfigData.GetTournamentMatchConfig(mid); if (tournamentMatchConfig.Date == day && Tournaments[tournamentConfig.Id].Results[tournamentMatchConfig.Offset].Winner == 0) { Tournaments[tournamentConfig.Id].CheckMatch(tournamentMatchConfig.Offset, true); } } } if (tournamentConfig.EndDate == day) { Tournaments[tournamentConfig.Id].Award(); } } }
private void virtualRegion_RegionEntered(int id, int x, int y, int key) { if (id == 1 && realTar != -1) { Image image = PeopleBook.GetPreview(people[realTar].Pid); tooltip.Show(image, this, x, y); } else { tooltip.Hide(this); } }
public static Image GetHeadImage(int pid) { if (pid > 0) { return(PeopleBook.GetPersonImage(pid)); } if (pid == -1) { if (head == null) { head = PicLoader.Read("Player", string.Format("{0}.PNG", UserProfile.InfoBasic.Face)); } return(head); } return(null); }
public override void Init(int width, int height) { base.Init(width, height); show = true; page = 0; people = new List <int>(); foreach (PeopleConfig peopleConfig in ConfigData.PeopleDict.Values) { if (PeopleBook.IsPeople(peopleConfig.Id) && peopleConfig.Emethod != "") { people.Add(peopleConfig.Id); } } totalCount = people.Count; UpdateButtonState(); }
public void AddRivalState(int id, bool isWin) { if (PeopleBook.IsPeople(id))//打怪不记录战绩 { if (!Rivals.ContainsKey(id)) { Rivals[id] = new DbRivalState(id); } if (isWin) { Rivals[id].Win++; } else { Rivals[id].Loss++; } } AchieveBook.CheckByCheckType("fight"); }
private void Fight() { if (realTar == -1) { return; } PeopleConfig peopleConfig = ConfigData.GetPeopleConfig(people[realTar].Pid); if (peopleConfig.Emethod == "") { ControlPlus.MessageBoxEx.Show("目前版本暂不开放!"); return; } var parm = new PeopleFightParm(); parm.Reason = PeopleFightReason.PeopleView; PeopleBook.Fight(peopleConfig.Id, peopleConfig.BattleMap, peopleConfig.Level, parm, null, null, null); }
public void CheckMatch(int mid, bool autoGiveup) { TournamentConfig tournamentConfig = ConfigData.GetTournamentConfig(Id); TournamentMatchConfig match = ConfigData.GetTournamentMatchConfig(mid); int left; int right; if (match.LeftType == 1) { left = Pids[match.LeftValue]; } else { left = Results[match.LeftValue].Winner; } if (match.RightType == 1) { right = Pids[match.RightValue]; } else { right = Results[match.RightValue].Winner; } currentMid = mid; currentAutoGiveUp = autoGiveup; currentRvId = left == -1 ? right : left; Results[mid] = new MatchResult(); if (left != -1 && right != -1) { FastBattle.Instance.StartGame(left, right, tournamentConfig.Map, -1); Results[mid].Winner = FastBattle.Instance.LeftWin ? left : right; Results[mid].Loser = FastBattle.Instance.LeftWin ? right : left; } else { PeopleBook.Fight(currentRvId, tournamentConfig.Map, 1, new PeopleFightParm(), OnWin, OnLose, null); } }
public TalkEventItemFight(int evtId, int level, Rectangle r, SceneQuestEvent e) : base(evtId, level, r, e) { int enemyId = config.EnemyId; HsActionCallback winCallback = OnWin; HsActionCallback failCallback = OnFail; var parm = new PeopleFightParm(); parm.Reason = PeopleFightReason.SceneQuest; if (evt.ParamList.Count > 1) { parm.RuleAddon = (PeopleFightRuleAddon)Enum.Parse(typeof(PeopleFightRuleAddon), evt.ParamList[0]); parm.RuleLevel = int.Parse(evt.ParamList[1]); } if (enemyId == 1)//特殊处理标记 { enemyId = UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.SceneQuestRandPeopleId); } int fightLevel = Math.Max(1, level + BlessManager.FightLevelChange); PeopleBook.Fight(enemyId, config.BattleMap, fightLevel, parm, winCallback, failCallback, failCallback); }
public RankData[] GetAllPeopleRank() { foreach (PeopleConfig peopleConfig in ConfigData.PeopleDict.Values) { if (PeopleBook.IsPeople(peopleConfig.Id)) { if (!Ranks.ContainsKey(peopleConfig.Id)) { Ranks.Add(peopleConfig.Id, peopleConfig.Level * 10); } } } List <RankData> rks = new List <RankData>(); foreach (var key in Ranks.Keys) { RankData data = new RankData { Id = key, Mark = Ranks[key] }; rks.Add(data); } return(rks.ToArray()); }
private void MonsterSkillViewForm_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, 320, 8); font.Dispose(); Font fontblack = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(245, 244, 242)), 65, cardHeight * yCount + 40, cardWidth * xCount, 100 + (7 - yCount) * cardHeight); e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(190, 175, 160)), 65, cardHeight * yCount + 40, cardWidth * xCount, 20); e.Graphics.DrawString("所有卡组", fontblack, Brushes.White, 65, cardHeight * yCount + 42); fontblack.Dispose(); cardDetail.Draw(e.Graphics); if (show) { int pages = totalCount / cardCount + 1; int cardLimit = (page < pages - 1) ? cardCount : (totalCount % cardCount); int former = cardCount * page + 1; if (isDirty) { tempImage.Dispose(); tempImage = new Bitmap(cardWidth * xCount, cardHeight * yCount); Graphics g = Graphics.FromImage(tempImage); for (int i = former - 1; i < former + cardLimit - 1; i++) { g.DrawImage(PeopleBook.GetPersonImage(people[i]), (i % xCount) * cardWidth, ((i / xCount) % yCount) * cardHeight, cardWidth, cardHeight); } g.Dispose(); isDirty = false; } e.Graphics.DrawImage(tempImage, 65, 35); if (sel != -1 && sel < totalCount) { SolidBrush yellowbrush = new SolidBrush(Color.FromArgb(80, Color.Lime)); int x = (sel % xCount) * cardWidth + 65; int y = ((sel / xCount) % yCount) * cardHeight + 35; e.Graphics.FillRectangle(yellowbrush, x, y, cardWidth, cardHeight); yellowbrush.Dispose(); Pen yellowpen = new Pen(Brushes.Lime, 3); e.Graphics.DrawRectangle(yellowpen, x, y, cardWidth, cardHeight); yellowpen.Dispose(); } if (tar != -1 && tar < totalCount) { int x = (tar % xCount) * cardWidth + 65; int y = ((tar / xCount) % yCount) * cardHeight + 35; SolidBrush yellowbrush = new SolidBrush(Color.FromArgb(80, Color.Yellow)); e.Graphics.FillRectangle(yellowbrush, x, y, cardWidth, cardHeight); yellowbrush.Dispose(); Pen yellowpen = new Pen(Brushes.Yellow, 3); e.Graphics.DrawRectangle(yellowpen, x, y, cardWidth, cardHeight); yellowpen.Dispose(); } } }
private void CheckCondition(string info) { string[] parms = info.Split('-'); var config = ConfigData.GetSceneQuestConfig(eventId); if (parms[0] == "flagno") { Disabled = UserProfile.InfoRecord.CheckFlag( (uint)(MemPlayerFlagTypes)Enum.Parse(typeof(MemPlayerFlagTypes), parms[1])); } else if (parms[0] == "flag") { Disabled = !UserProfile.InfoRecord.CheckFlag( (uint)(MemPlayerFlagTypes)Enum.Parse(typeof(MemPlayerFlagTypes), parms[1])); } else if (parms[0] == "questno") { Disabled = UserProfile.InfoQuest.IsQuestFinish(config.QuestNeed); } else if (parms[0] == "quest") { Disabled = !UserProfile.InfoQuest.IsQuestFinish(config.QuestNeed); } else if (parms[0] == "questeq") { Disabled = UserProfile.InfoQuest.QuestId != config.QuestNeed; } else if (parms[0] == "rivalavail") { Disabled = !UserProfile.InfoRival.GetRivalState(config.EnemyId).Avail; } else if (parms[0] == "rivalavailno") { Disabled = UserProfile.InfoRival.GetRivalState(config.EnemyId).Avail; } else if (parms[0] == "sceneno") { Disabled = Scene.Instance.HasSceneItemWithName(parms[1]); } else if (parms[0] == "questfin") { Disabled = !Scene.Instance.IsSceneAllQuestOpened(); } else if (parms[0] == "cantrade") { int multi = int.Parse(parms[1]); uint goldNeed = 0; if (config.TradeGold < 0) { goldNeed = GameResourceBook.OutGoldSceneQuest(level, -config.TradeGold * multi, true); } uint foodNeed = 0; if (config.TradeFood < 0) { foodNeed = Math.Min(100, GameResourceBook.OutFoodSceneQuest(-config.TradeFood * multi, true)); } uint healthNeed = 0; if (config.TradeHealth < 0) { healthNeed = Math.Min(100, GameResourceBook.OutHealthSceneQuest(-config.TradeHealth * multi, true)); } uint mentalNeed = 0; if (config.TradeMental < 0) { mentalNeed = Math.Min(100, GameResourceBook.OutMentalSceneQuest(-config.TradeMental * multi, true)); } Disabled = !UserProfile.Profile.InfoBag.HasResource(GameResourceType.Gold, goldNeed) || UserProfile.Profile.InfoBasic.FoodPoint < foodNeed || UserProfile.Profile.InfoBasic.HealthPoint < healthNeed || UserProfile.Profile.InfoBasic.MentalPoint < mentalNeed; uint goldAdd = 0; if (config.TradeGold > 0) { goldAdd = GameResourceBook.InGoldSceneQuest(level, config.TradeGold * multi, true); } uint foodAdd = 0; if (config.TradeFood > 0) { foodAdd = Math.Min(100, GameResourceBook.InFoodSceneQuest(config.TradeFood * multi, true)); } uint healthAdd = 0; if (config.TradeHealth > 0) { healthAdd = Math.Min(100, GameResourceBook.InHealthSceneQuest(config.TradeHealth * multi, true)); } uint mentalAdd = 0; if (config.TradeMental > 0) { mentalAdd = Math.Min(100, GameResourceBook.InMentalSceneQuest(config.TradeMental * multi, true)); } Script = string.Format("增加{0}(消耗{1})", GetTradeStr(goldAdd, foodAdd, healthAdd, mentalAdd), GetTradeStr(goldNeed, foodNeed, healthNeed, mentalNeed)); } else if (parms[0] == "hasrival") { int pid = PeopleBook.GetRandomPeopleId(level - 3, level + 3); Disabled = UserProfile.InfoRival.GetRivalState(pid).Avail; UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.SceneQuestRandPeopleId, pid); Script = string.Format("偶遇了{0},我们来切磋一下吧", ConfigData.GetPeopleConfig(pid).Name); } }
private void virtualRegion_RegionEntered(int id, int x, int y, int key) { { var region = vRegion.GetRegion(id) as PictureRegion; if (region != null) { var regionType = region.GetVType(); if (regionType == PictureRegionCellType.Item) { Image image = HItemBook.GetPreview(key); tooltip.Show(image, parent, x, y); } else if (regionType == PictureRegionCellType.Equip) { Equip equip = new Equip(key); Image image = equip.GetPreview(); tooltip.Show(image, parent, x, y); } else if (regionType == PictureRegionCellType.Bless) { Image image = BlessBook.GetPreview(key); tooltip.Show(image, parent, x, y); } else if (regionType == PictureRegionCellType.People) { Image image = PeopleBook.GetPreview(key); tooltip.Show(image, parent, x, y); } } } { var region = vRegion.GetRegion(id) as ImageRegion; if (region != null) { var regionType = region.GetVType(); if (regionType == ImageRegionCellType.Gold) { string resStr = string.Format("黄金:{0}", region.Parm); Image image = DrawTool.GetImageByString(resStr, 100); tooltip.Show(image, parent, x, y); } else if (regionType == ImageRegionCellType.Food) { string resStr = string.Format("食物:{0}", region.Parm); Image image = DrawTool.GetImageByString(resStr, 100); tooltip.Show(image, parent, x, y); } else if (regionType == ImageRegionCellType.Health) { string resStr = string.Format("生命:{0}", region.Parm); Image image = DrawTool.GetImageByString(resStr, 100); tooltip.Show(image, parent, x, y); } else if (regionType == ImageRegionCellType.Mental) { string resStr = string.Format("精神:{0}", region.Parm); Image image = DrawTool.GetImageByString(resStr, 100); tooltip.Show(image, parent, x, y); } else if (regionType == ImageRegionCellType.Exp) { string resStr = string.Format("经验值:{0}", region.Parm); Image image = DrawTool.GetImageByString(resStr, 100); tooltip.Show(image, parent, x, y); } } } }
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) { } }