public void CheckDungeonItem() { if (CheckState()) { foreach (var gismoId in gismoList) { if (GetGismo(gismoId)) //已经有了 { continue; } var gismoConfig = ConfigData.GetDungeonGismoConfig(gismoId); if (!CheckEnvironmentState(gismoConfig)) { return; } if (!string.IsNullOrEmpty(gismoConfig.NeedDungeonItemId) && UserProfile.InfoDungeon.GetDungeonItemCount(DungeonBook.GetDungeonItemId(gismoConfig.NeedDungeonItemId)) >= gismoConfig.NeedDungeonItemCount) { AddGismo(gismoId); } } } }
} //中心图片缩放 public override void ShowTip(ImageToolTip tooltip, Control form, int x, int y) { var regionType = GetVType(); if (regionType == PictureRegionCellType.Item) { Image image = HItemBook.GetPreview(nid); tooltip.Show(image, form, x, y); } else if (regionType == PictureRegionCellType.Gismo) { Image image = DungeonBook.GetPreview(nid); tooltip.Show(image, form, x, y); } else if (regionType == PictureRegionCellType.People) { Image image = SamuraiBook.GetPreview(nid); tooltip.Show(image, form, x, y); } else if (regionType == PictureRegionCellType.DungeonItem) { var itemConfig = ConfigData.GetDungeonItemConfig(nid); Image image = DrawTool.GetImageByString(itemConfig.Name + "$" + itemConfig.Des, 160); tooltip.Show(image, form, x, y); } }
public override void Init() { base.Init(); switch (evt.Type) { case "removeditem": var itemId = DungeonBook.GetDungeonItemId(config.NeedDungeonItemId); UserProfile.InfoDungeon.RemoveDungeonItem(itemId, config.NeedDungeonItemCount); break; } if (evt.Children.Count > 0) { result = evt.Children[0];//应该是一个say } }
private void RewardItem(ref int index) { if (!string.IsNullOrEmpty(config.RewardItem)) { var itemId = HItemBook.GetItemId(config.RewardItem); UserProfile.InfoBag.AddItem(itemId, 1); vRegion.AddRegion(new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60, PictureRegionCellType.Item, itemId)); index++; } if (!string.IsNullOrEmpty(config.RewardDrop)) { var itemList = DropBook.GetDropItemList(config.RewardDrop); foreach (var itemId in itemList) { UserProfile.InfoBag.AddItem(itemId, 1); vRegion.AddRegion(new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60, PictureRegionCellType.Item, itemId)); index++; } } if (!string.IsNullOrEmpty(config.RewardDungeonItemId) && UserProfile.InfoDungeon.DungeonId > 0) { var itemId = DungeonBook.GetDungeonItemId(config.RewardDungeonItemId); UserProfile.InfoDungeon.AddDungeonItem(itemId, config.RewardDungeonItemCount); var pictureRegion = new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60, PictureRegionCellType.DungeonItem, itemId); pictureRegion.Scale = 0.7f; var textControl = new RegionTextDecorator(3, 60 - 20, 11, Color.White, true, config.RewardDungeonItemCount.ToString()); pictureRegion.AddDecorator(textControl); pictureRegion.AddDecorator(new RegionBorderDecorator(Color.White)); vRegion.AddRegion(pictureRegion); index++; } }
public override void Draw(Graphics g) { if (nid > 0) { Image img = null; HsActionCallback preAction = null; HsActionCallback action = null; if (type == PictureRegionCellType.Item) { img = HItemBook.GetHItemImage(nid); action = () => { var itemConfig = ConfigData.GetHItemConfig(nid); var pen = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2); g.DrawRectangle(pen, X, Y, Width, Height); pen.Dispose(); }; } else if (type == PictureRegionCellType.Gismo) { img = DungeonBook.GetGismoImage(nid); } else if (type == PictureRegionCellType.People) { img = HSIcons.GetImage("Samurai", nid); preAction = () => { var peopleConfig = ConfigData.GetSamuraiConfig(nid); var brush = new SolidBrush(Color.FromName(HSTypes.I2QualityColorD(peopleConfig.Quality))); g.FillRectangle(brush, X + 3, Y + 3, Width - 6, Height - 6); brush.Dispose(); }; } else if (type == PictureRegionCellType.SceneQuest) { img = SceneQuestBook.GetSceneQuestImageScene(nid); } else if (type == PictureRegionCellType.DungeonItem) { img = DungeonBook.GetDungeonItemImage(nid); } if (preAction != null) { preAction(); } if (img != null) { if (Scale == 1) { if (Enabled) { g.DrawImage(img, X, Y, Width, Height); } else { g.DrawImage(img, new Rectangle(X, Y, Width, Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray); } } else { int realWidth = (int)(Width * Scale); int realHeight = (int)(Height * Scale); g.DrawImage(img, X + (Width - realWidth) / 2, Y + (Height - realHeight) / 2, realWidth, realHeight); } } if (action != null) { action(); } } foreach (IRegionDecorator decorator in decorators) { decorator.Draw(g, X, Y, Width, Height); } }
private void CheckCondition(string info) { string[] parms = info.Split('-'); var config = ConfigData.GetSceneQuestConfig(eventId); if (parms[0] == "cantrade") { int multi = int.Parse(parms[1]); string type = "all"; if (parms.Length > 2) { type = parms[2]; } double multiNeed = multi * MathTool.Clamp(1, 0.2, 5); double multiGet = multi * MathTool.Clamp(1, 0.2, 5); uint goldNeed = 0; if (config.TradeGold < 0) { goldNeed = GameResourceBook.OutGoldSceneQuest(level, (int)(-config.TradeGold * multiNeed), true); } uint foodNeed = 0; if (config.TradeFood < 0) { foodNeed = Math.Min(100, GameResourceBook.OutFoodSceneQuest((int)(-config.TradeFood * multiNeed), true)); } uint healthNeed = 0; if (config.TradeHealth < 0) { healthNeed = Math.Min(100, GameResourceBook.OutHealthSceneQuest((int)(-config.TradeHealth * multiNeed), true)); } uint mentalNeed = 0; if (config.TradeMental < 0) { mentalNeed = Math.Min(100, GameResourceBook.OutMentalSceneQuest((int)(-config.TradeMental * multiNeed), true)); } Disabled = !UserProfile.Profile.InfoBag.HasResource(GameResourceType.Gold, goldNeed) || UserProfile.Profile.InfoBasic.FoodPoint < foodNeed || UserProfile.Profile.InfoBasic.HealthPoint < healthNeed || UserProfile.Profile.InfoBasic.MentalPoint < mentalNeed; if (string.IsNullOrEmpty(config.TradeDropItem)) { uint goldAdd = 0; if (config.TradeGold > 0 && (type == "all" || type == "gold")) { goldAdd = GameResourceBook.InGoldSceneQuest(level, (int)(config.TradeGold * multiGet), true); } uint foodAdd = 0; if (config.TradeFood > 0 && (type == "all" || type == "food")) { foodAdd = Math.Min(100, GameResourceBook.InFoodSceneQuest((int)(config.TradeFood * multiGet), true)); } uint healthAdd = 0; if (config.TradeHealth > 0 && (type == "all" || type == "health")) { healthAdd = Math.Min(100, GameResourceBook.InHealthSceneQuest((int)(config.TradeHealth * multiGet), true)); } uint mentalAdd = 0; if (config.TradeMental > 0 && (type == "all" || type == "mental")) { mentalAdd = Math.Min(100, GameResourceBook.InMentalSceneQuest((int)(config.TradeMental * multiGet), true)); } Script = string.Format("获得{0}(消耗{1})", GetTradeStr(goldAdd, foodAdd, healthAdd, mentalAdd), GetTradeStr(goldNeed, foodNeed, healthNeed, mentalNeed)); } else { var dropId = DropBook.GetDropId(config.TradeDropItem); Script = string.Format("获得{0}(消耗{1})", ConfigData.GetDropConfig(dropId).Name, GetTradeStr(goldNeed, foodNeed, healthNeed, mentalNeed)); } } else if (parms[0] == "cantest") { int type = int.Parse(parms[1]); bool canConvert = type == 1; //是否允许转换成幸运检测 var testType = type == 1 ? config.TestType1 : config.TestType2; int sourceVal = UserProfile.InfoDungeon.GetAttrByStr(testType); Disabled = UserProfile.InfoDungeon.DungeonId <= 0 || sourceVal < 0; if (Disabled && canConvert) { Disabled = false; } if (!Disabled) { var biasData = type == 1 ? config.TestBias1 : config.TestBias2; if (UserProfile.InfoDungeon.DungeonId > 0 && UserProfile.InfoDungeon.GetAttrByStr(testType) >= 0) { var attrNeed = UserProfile.InfoDungeon.GetRequireAttrByStr(testType, biasData); Script = string.Format("|icon.oth1||进行{0}考验|lime|(判定{1} {2:0.0}%胜率)", GetTestAttrStr(testType), attrNeed, GetWinRate(UserProfile.InfoDungeon.GetAttrByStr(testType) + 0.5f, attrNeed)); } else //因为convert了 { Script = string.Format("|icon.oth1||进行运气考验|lime|(判定{0} {1:0.0}%胜率)", 3 + biasData, GetWinRate(3.5f, 3 + biasData)); } } } else if (parms[0] == "hasditem") { var itemId = DungeonBook.GetDungeonItemId(config.NeedDungeonItemId); Disabled = UserProfile.InfoDungeon.GetDungeonItemCount(itemId) < config.NeedDungeonItemCount; } else if (parms[0] == "hasdna") { if (config.DnaInfo != null && config.DnaInfo.Length > 0) { string dnaStr = ""; int dnaId = 0; foreach (var dnaName in config.DnaInfo) { var nowId = DnaBook.GetDnaId(dnaName); dnaId |= (int)Math.Pow(2, nowId); dnaStr += ConfigData.GetPlayerDnaConfig(nowId).Name + " "; } Script = string.Format("|icon.oth14||{0}|lime|(DNA限定{1})", Script, dnaStr); Disabled = !UserProfile.InfoBasic.HasDna(dnaId); } } }