private void AddSkillRow(WzImageProperty s) { var id = int.Parse(s.Name); var name = StringWz.GetSkill(s.Name); var properties = GetAllProperties(s); WzObject icon = s.GetFromPath("icon"); SkillsView.GridView.Rows.Add(id, icon?.GetBitmap(), name, properties); }
public override Bitmap GetBitmap() { if (this["_inlink"] is WzStringProperty inlink) { WzObject currentWzObj = this; // first object to work with while ((currentWzObj = currentWzObj.Parent) != null) { if (!(currentWzObj is WzImage)) // keep looping if its not a WzImage { continue; } WzImage wzImageParent = (WzImage)currentWzObj; WzImageProperty foundProperty = wzImageParent.GetFromPath(inlink.Value); if (foundProperty != null && foundProperty is WzImageProperty) { return(foundProperty.GetBitmap()); } } } else if (this["_outlink"] is WzStringProperty outlink) { WzObject foundProperty = WzFileParent.GetObjectFromPath(outlink.Value); if (foundProperty is WzImageProperty) { return(foundProperty.GetBitmap()); } } return(imageProp.GetPNG(false)); }
private void AddSkillRow(WzImageProperty s) { int id = int.Parse(s.Name); string name = StringUtility.GetSkill(s.Name); string properties = BuildProperties(s); WzObject icon = s.GetFromPath("icon"); SkillsView.GridView.Rows.Add(id, icon?.GetBitmap(), name, properties); }
public override Bitmap GetBitmap() { if (InLink != null) { WzObject currentWzObj = this; // first object to work with while ((currentWzObj = currentWzObj.Parent) != null) { if (!(currentWzObj is WzImage)) // keep looping if its not a WzImage { continue; } WzImage wzImageParent = (WzImage)currentWzObj; WzImageProperty foundProperty = wzImageParent.GetFromPath(InLink.Value); if (foundProperty != null && foundProperty is WzImageProperty) { return(foundProperty.GetBitmap()); } } } else if (OutLink != null) { WzObject foundProperty = WzFileParent.GetObjectFromPath(OutLink.Value); if (foundProperty?.OutLink != null) { if (foundProperty.WzFileParent.GetObjectFromPath(foundProperty.OutLink.Value) == this) { Console.WriteLine("RECURSION FOUND"); // recursive linking, who the f**k did this?? return(null); } } if (foundProperty is WzImageProperty) { return(foundProperty.GetBitmap()); } } return(imageProp.GetPNG(false)); }
private void ShowObjectValue(WzObject obj) { mp3Player.SoundProperty = null; nameBox.Text = obj is WzFile ? ((WzFile)obj).Header.Copyright : obj.Name; nameBox.ButtonEnabled = false; if (obj is WzFile || obj is WzDirectory || obj is WzImage || obj is WzNullProperty || obj is WzSubProperty || obj is WzConvexProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = false; mp3Player.Visible = false; vectorPanel.Visible = false; applyChangesButton.Visible = false; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else if (obj is WzCanvasProperty) { nameBox.Visible = true; canvasPropBox.Visible = true; pictureBoxPanel.Visible = true; textPropBox.Visible = false; mp3Player.Visible = false; canvasPropBox.Image = obj.GetBitmap(); vectorPanel.Visible = false; applyChangesButton.Visible = false; changeImageButton.Visible = true; saveImageButton.Visible = true; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else if (obj is WzSoundProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = false; mp3Player.Visible = true; mp3Player.SoundProperty = (WzSoundProperty)obj; vectorPanel.Visible = false; applyChangesButton.Visible = false; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = true; saveSoundButton.Visible = true; } else if (obj is WzStringProperty || obj is WzIntProperty || obj is WzDoubleProperty || obj is WzFloatProperty || obj is WzShortProperty || obj is WzUOLProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = true; mp3Player.Visible = false; textPropBox.Text = obj.ToString(); vectorPanel.Visible = false; applyChangesButton.Visible = true; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else if (obj is WzVectorProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = false; mp3Player.Visible = false; vectorPanel.Visible = true; vectorPanel.X = ((WzVectorProperty)obj).X.Value; vectorPanel.Y = ((WzVectorProperty)obj).Y.Value; applyChangesButton.Visible = true; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else { } }
private void AddGridRow(DataGridView grid, object wzObject) { int id; string properties = BuildProperties(wzObject); string name = null; WzObject icon = null; if (wzObject is WzImage image) { id = int.Parse(Path.GetFileNameWithoutExtension(image.Name)); properties = BuildProperties(image) ?? ""; WzImageProperty linkProperty = image.GetFromPath("info/link"); if (linkProperty != null) { string linkName = ((WzStringProperty)linkProperty).Value; image = ((WzDirectory)image.Parent).GetChildImages().Find(p => p.Name.Equals(linkName + ".img")); if (image == null) { return; } } WzObject entityIcon = image.GetFromPath("stand/0"); if (image.WzFileParent.Name.StartsWith("Npc")) // icon path like: '{ID}/stand/0' { name = StringUtility.GetNPC(id); } else if (image.WzFileParent.Name.StartsWith("Mob")) // icon path like: '{ID}/(move|stand|fly)/0' { name = StringUtility.GetMob(id); if (entityIcon == null) { entityIcon = image.GetFromPath("fly/0") ?? image.GetFromPath("move/0"); // attempt to get image of the monster } } else if (image.WzFileParent.Name.StartsWith("Reactor")) { name = image.GetFromPath("action")?.WzValue.ToString(); entityIcon = image.GetFromPath("0/0"); } else // for breadcrumb like: '{ID}.img/info/icon' { if (ItemConstants.IsEquip(id)) { name = StringUtility.GetEqp(id); } else if (ItemConstants.IsPet(id)) { name = StringUtility.GetPet(id); } icon = image.GetFromPath("info/icon"); } if (icon == null) { icon = entityIcon; } } else if (wzObject is WzSubProperty subProperty) { // for path like: 'category.img/{ID}/info/icon' (Etc.wz) string imgName = subProperty.Name; id = int.Parse(imgName); if (ItemConstants.IsEtc(id)) { name = StringUtility.GetEtc(id); } else if (ItemConstants.IsCash(id)) { name = StringUtility.GetCash(id); } else if (ItemConstants.IsChair(id)) { name = StringUtility.GetChair(id); } else if (ItemConstants.IsConsume(id)) { name = StringUtility.GetConsume(id); } icon = subProperty.GetFromPath("info/icon"); } else { return; } grid.Rows.Add(id, icon?.GetBitmap(), name, properties); }