/// <summary> /// Button on create map /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonCreateFrmClone_Click(object sender, EventArgs e) { if (numericUpDown1.Value == -1) { return; } long mapid = (long)numericUpDown1.Value; // should be int, but anyway in case the future version uses more than 2.1b string mapId_str = mapid.ToString(); string mapId_PaddingZeros = mapId_str.PadLeft(9, '0') + ".img"; // 100000000.img.xml string mapcat = "Map" + mapId_PaddingZeros.Substring(0, 1); WzDirectory directory = Program.WzManager.FindMapWz(mapcat); WzImage mapImage = (WzImage)directory[mapId_PaddingZeros]; if (mapImage == null) { MessageBox.Show("Map is null."); return; } WzSubProperty strMapProp = WzInfoTools.GetMapStringProp(mapId_str); string cloneMapName = WzInfoTools.GetMapName(strMapProp); string cloneStreetName = WzInfoTools.GetMapStreetName(strMapProp); string cloneCategoryName = WzInfoTools.GetMapCategoryName(strMapProp); MapLoader.CreateMapFromImage(-1 /*mapid*/, mapImage.DeepClone(), cloneMapName, cloneStreetName, cloneCategoryName, (WzSubProperty)strMapProp.DeepClone(), Tabs, multiBoard, rightClickHandler); Close(); }
private void SetDefStatsValue(EquipStat.Id id, WzSubProperty src, string srcKey) { if (src[srcKey] != null) { _defStats[id] = (short)src[srcKey]; } }
private static ObjectInfo Load(WzSubProperty parentObject, string oS, string l0, string l1, string l2) { WzCanvasProperty frame1 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject["0"]); ObjectInfo result = new ObjectInfo( frame1.GetLinkedWzCanvasBitmap(), WzInfoTools.PointFToSystemPoint(frame1.GetCanvasOriginPosition()), oS, l0, l1, l2, parentObject); WzImageProperty chairs = parentObject["seat"]; WzImageProperty ropes = frame1["rope"]; WzImageProperty ladders = frame1["ladder"]; WzImageProperty footholds = frame1["foothold"]; result.footholdOffsets = ParsePropToOffsetMap(footholds); result.ropeOffsets = ParsePropToOffsetMap(ropes); result.ladderOffsets = ParsePropToOffsetMap(ladders); if (chairs != null) { result.chairOffsets = ParsePropToOffsetList(chairs); } return(result); }
/// <summary> /// NPC /// </summary> /// <param name="texturePool"></param> /// <param name="npcInstance"></param> /// <param name="device"></param> /// <param name="usedProps"></param> /// <returns></returns> public static NpcItem CreateNpcFromProperty(TexturePool texturePool, NpcInstance npcInstance, GraphicsDevice device, ref List <WzObject> usedProps) { NpcInfo npcInfo = (NpcInfo)npcInstance.BaseInfo; WzImage source = npcInfo.LinkedWzImage; List <IDXObject> frames = new List <IDXObject>(); // All frames "stand", "speak" "blink" "hair", "angry", "wink" etc foreach (WzImageProperty childProperty in source.WzProperties) { WzSubProperty npcStateProperty = (WzSubProperty)childProperty; switch (npcStateProperty.Name) { case "info": // info/speak/0 WzStringProperty { break; } default: { frames.AddRange(LoadFrames(texturePool, npcStateProperty, npcInstance.X, npcInstance.Y, device, ref usedProps)); break; } } } return(new NpcItem(npcInstance, frames)); }
public ObjectInfo Add(Bitmap bmp, string name) { if (!IsNameValid(name)) { throw new NameAlreadyUsedException(); } Point origin = new Point(bmp.Width / 2, bmp.Height / 2); WzSubProperty prop = new WzSubProperty(); WzCanvasProperty canvasProp = new WzCanvasProperty(); canvasProp.PngProperty = new WzPngProperty(); canvasProp.PngProperty.SetImage(bmp); canvasProp["origin"] = new WzVectorProperty("", new WzIntProperty("X", origin.X), new WzIntProperty("Y", origin.Y)); canvasProp["z"] = new WzIntProperty("", 0); prop["0"] = canvasProp; ObjectInfo oi = new ObjectInfo(bmp, origin, oS, Program.APP_NAME, l1, name, prop); newObjects.Add(oi); newObjectsData.Add(name, SaveImageToBytes(bmp)); SerializeObjects(); l1prop[name] = prop; return(oi); }
/// <summary> /// Writes the WzImage object to the underlying WzBinaryWriter /// </summary> /// <param name="writer"></param> /// <param name="forceReadFromData">Read from data regardless of base data that's changed or not.</param> public void SaveImage(WzBinaryWriter writer, bool forceReadFromData = false) { if (changed || forceReadFromData) { if (reader != null && !parsed) { this.ParseEverything = true; ParseImage(forceReadFromData); } WzSubProperty imgProp = new WzSubProperty(); long startPos = writer.BaseStream.Position; imgProp.AddPropertiesForWzImageDumping(WzProperties); imgProp.WriteValue(writer); writer.StringCache.Clear(); size = (int)(writer.BaseStream.Position - startPos); } else { long pos = reader.BaseStream.Position; reader.BaseStream.Position = offset; writer.Write(reader.ReadBytes(size)); reader.BaseStream.Position = pos; } }
public void ExtractPortals() { WzSubProperty portalParent = (WzSubProperty)this["map"]["MapHelper.img"]["portal"]; WzSubProperty editorParent = (WzSubProperty)portalParent["editor"]; for (int i = 0; i < editorParent.WzProperties.Count; i++) { WzCanvasProperty portal = (WzCanvasProperty)editorParent.WzProperties[i]; Program.InfoManager.PortalTypeById.Add(portal.Name); PortalInfo.Load(portal); } WzSubProperty gameParent = (WzSubProperty)portalParent["game"]["pv"]; foreach (WzImageProperty portal in gameParent.WzProperties) { if (portal.WzProperties[0] is WzSubProperty) { Dictionary <string, Bitmap> images = new Dictionary <string, Bitmap>(); Bitmap defaultImage = null; foreach (WzSubProperty image in portal.WzProperties) { //WzSubProperty portalContinue = (WzSubProperty)image["portalContinue"]; //if (portalContinue == null) continue; Bitmap portalImage = image["0"].GetBitmap(); if (image.Name == "default") { defaultImage = portalImage; } else { images.Add(image.Name, portalImage); } } Program.InfoManager.GamePortals.Add(portal.Name, new PortalGameImageInfo(defaultImage, images)); } else if (portal.WzProperties[0] is WzCanvasProperty) { Dictionary <string, Bitmap> images = new Dictionary <string, Bitmap>(); Bitmap defaultImage = null; try { foreach (WzCanvasProperty image in portal.WzProperties) { //WzSubProperty portalContinue = (WzSubProperty)image["portalContinue"]; //if (portalContinue == null) continue; Bitmap portalImage = image.GetLinkedWzCanvasBitmap(); defaultImage = portalImage; images.Add(image.Name, portalImage); } Program.InfoManager.GamePortals.Add(portal.Name, new PortalGameImageInfo(defaultImage, images)); } catch (InvalidCastException) { continue; } //nexon likes to toss ints in here zType etc } } for (int i = 0; i < Program.InfoManager.PortalTypeById.Count; i++) { Program.InfoManager.PortalIdByType[Program.InfoManager.PortalTypeById[i]] = i; } }
public UserObjectsManager(MultiBoard multiBoard) { this.multiBoard = multiBoard; if (Program.InfoManager == null) { // Prevents VS designer from crashing when rendering this control; there is no way that Program.InfoManager will be null // in the real execution of this code. return; } // Make sure that all our structures exist if (!Program.InfoManager.ObjectSets.ContainsKey(oS)) { Program.InfoManager.ObjectSets[oS] = new WzImage(oS); Program.InfoManager.ObjectSets[oS].Changed = true; } WzImage osimg = Program.InfoManager.ObjectSets[oS]; if (osimg[Program.APP_NAME] == null) { osimg[Program.APP_NAME] = new WzSubProperty(); } WzImageProperty l0prop = osimg[Program.APP_NAME]; if (l0prop[l1] == null) { l0prop[l1] = new WzSubProperty(); } l1prop = l0prop[l1]; }
public void LoadBackgrounds(WzImage mapImage, Board mapBoard) { WzSubProperty bgParent = (WzSubProperty)mapImage["back"]; WzSubProperty bgProp; int i = 0; while ((bgProp = (WzSubProperty)bgParent[(i++).ToString()]) != null) { int x = InfoTool.GetInt(bgProp["x"]); int y = InfoTool.GetInt(bgProp["y"]); int rx = InfoTool.GetInt(bgProp["rx"]); int ry = InfoTool.GetInt(bgProp["ry"]); int cx = InfoTool.GetInt(bgProp["cx"]); int cy = InfoTool.GetInt(bgProp["cy"]); int a = InfoTool.GetInt(bgProp["a"]); BackgroundType type = (BackgroundType)InfoTool.GetInt(bgProp["type"]); bool front = InfoTool.GetBool(bgProp["front"]); bool? flip_t = InfoTool.GetOptionalBool(bgProp["f"]); bool flip = flip_t.HasValue ? flip_t.Value : false; string bS = InfoTool.GetString(bgProp["bS"]); bool ani = InfoTool.GetBool(bgProp["ani"]); string no = InfoTool.GetInt(bgProp["no"]).ToString(); BackgroundInfo bgInfo = BackgroundInfo.Get(bS, ani, no); if (bgInfo == null) { continue; } IList list = front ? mapBoard.BoardItems.FrontBackgrounds : mapBoard.BoardItems.BackBackgrounds; list.Add((BackgroundInstance)bgInfo.CreateInstance(mapBoard, x, y, i, rx, ry, cx, cy, type, a, front, flip)); } }
public void ExtractMaps(WzSubProperty pSubProperty) { foreach (var key in pSubProperty.WzProperties.Where(val => { return(val is WzSubProperty); })) { int id = Convert.ToInt32(key.Name); var name = key["mapName"]; if (name != null) { SQLStrings.Instance.AppendRow("map", id, "name", name.ToStringValue()); } var street = key["streetName"]; if (street != null) { SQLStrings.Instance.AppendRow("map", id, "street", street.ToStringValue()); } var desc = key["mapDesc"]; if (desc != null) { SQLStrings.Instance.AppendRow("map", id, "desc", desc.ToStringValue()); } } }
/// <summary> /// Writes the WzImage object to the underlying WzBinaryWriter /// </summary> /// <param name="writer"></param> /// <param name="bIsWzUserKeyDefault">Uses the default MapleStory UserKey or a custom key.</param> /// <param name="forceReadFromData">Read from data regardless of base data that's changed or not.</param> public void SaveImage(WzBinaryWriter writer, bool bIsWzUserKeyDefault = true, bool forceReadFromData = false) { if (bIsImageChanged || !bIsWzUserKeyDefault || // everything needs to be re-written when a custom UserKey is used forceReadFromData) // if its not being force-read and written, it saves with the previous WZ encryption IV. { if (reader != null && !parsed) { this.ParseEverything = true; ParseImage(forceReadFromData); } WzSubProperty imgProp = new WzSubProperty(); long startPos = writer.BaseStream.Position; imgProp.AddPropertiesForWzImageDumping(WzProperties); imgProp.WriteValue(writer); writer.StringCache.Clear(); size = (int)(writer.BaseStream.Position - startPos); } else { long pos = reader.BaseStream.Position; reader.BaseStream.Position = offset; writer.Write(reader.ReadBytes(size)); reader.BaseStream.Position = pos; } }
public BodyAction(WzSubProperty src) { _stance = Look.Stance.ByString(((WzStringProperty)src["action"]).Value); if (src["frame"] != null) { Frame = (short)src["frame"]; } WzObject moveProperty = src["move"]; if (moveProperty != null && moveProperty is WzVectorProperty) { _move = (Vector2)moveProperty.WzValue; } short sgnDelay = 0; if (src["delay"] != null) { sgnDelay = (short)src["delay"]; } if (sgnDelay == 0) { sgnDelay = 100; } if (sgnDelay > 0) { Delay = sgnDelay; AttackFrame = true; } else if (sgnDelay < 0) { Delay = (short)-sgnDelay; AttackFrame = false; } }
public static string GetFieldFullName(int mapId) { string path; int section = mapId / 10000000; if (section <= 9) { path = "maple"; } else if (section >= 10 && section <= 19) { path = "victoria"; } else if (section >= 20 && section <= 28) { path = "ossyria"; } else if (section >= 50 && section <= 55) { path = "singapore"; } else if (section >= 60 && section <= 61) { path = "MasteriaGL"; } else if (section >= 67 && section <= 68) { path = "weddingGL"; } else { path = "etc"; } path += "/" + mapId; WzSubProperty subProperty = (WzSubProperty)_map.GetFromPath(path); if (subProperty == null) { return("NO-NAME"); } string retName = ""; WzStringProperty mapName = (WzStringProperty)subProperty.GetFromPath("mapName"); WzStringProperty streetName = (WzStringProperty)subProperty.GetFromPath("streetName"); if (mapName != null) { retName += mapName.Value; } if (mapName != null && streetName != null) { retName += " - "; // x f*****g d } if (streetName != null) { retName += streetName.Value; } return(retName); }
public static string GetMapCategoryName(WzSubProperty mapProp) { if (mapProp == null) { return(""); } return(mapProp.Parent.Name); }
public static ObjectInfo Load(WzSubProperty parentObject, string oS, string l0, string l1, string l2) { WzCanvasProperty frame1 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject["0"]); ObjectInfo result = new ObjectInfo(frame1.PngProperty.GetPNG(false), WzInfoTools.VectorToSystemPoint((WzVectorProperty)frame1["origin"]), oS, l0, l1, l2, parentObject); WzSubProperty chairs = (WzSubProperty)parentObject["seat"]; IWzImageProperty footholds = (IWzImageProperty)frame1["foothold"]; if (footholds != null) { if (footholds is WzConvexProperty) { result.fullFootholdInfo = false; result.footholdOffsets = new List <XNA.Point>(); foreach (WzVectorProperty fhAnchor in footholds.WzProperties) { result.footholdOffsets.Add(WzInfoTools.VectorToXNAPoint(fhAnchor)); } } else { result.fullFootholdInfo = true; result.footholdFullOffsets = new List <List <XNA.Point> >(); List <XNA.Point> fhAnchorList = new List <XNA.Point>(); foreach (WzConvexProperty fh in footholds.WzProperties) { foreach (WzVectorProperty fhAnchor in fh.WzProperties) { fhAnchorList.Add(WzInfoTools.VectorToXNAPoint(fhAnchor)); } result.footholdFullOffsets.Add(fhAnchorList); fhAnchorList = new List <XNA.Point>(); } } } //IWzImageProperty ropes = (IWzImageProperty)frame1["ladder"]; if (chairs != null) { result.chairOffsets = new List <XNA.Point>(); foreach (WzVectorProperty chair in chairs.WzProperties) { result.chairOffsets.Add(WzInfoTools.VectorToXNAPoint(chair)); } } /*if (footholds != null) * foreach (WzVectorProperty foothold in footholds.WzProperties) * result.footholdOffsets.Add(WzInfoTools.VectorToXNAPoint(foothold));*/ /*if (ropes != null && ropes.WzProperties.Count > 0) * if (ropes.WzProperties[0] is WzVectorProperty) * foreach (WzVectorProperty rope in ropes.WzProperties) * result.ropeOffsets.Add(WzInfoTools.VectorToXNAPoint(rope)); * else if (ropes.WzProperties[0] is WzConvexProperty) * foreach (WzConvexProperty convex in ropes.WzProperties) * foreach (WzVectorProperty rope in convex.WzProperties) * result.ropeOffsets.Add(WzInfoTools.VectorToXNAPoint(rope)); * else throw new Exception("wrong rope anchor type at ObjectInfo Load");*/ return(result); }
public void LoadToolTips(WzImage mapImage, Board mapBoard) { WzSubProperty tooltipsParent = (WzSubProperty)mapImage["ToolTip"]; if (tooltipsParent == null) { return; } WzImage tooltipsStringImage = (WzImage)Program.WzManager.String["ToolTipHelp.img"]; if (!tooltipsStringImage.Parsed) { tooltipsStringImage.ParseImage(); } WzSubProperty tooltipStrings = (WzSubProperty)tooltipsStringImage["Mapobject"][mapBoard.MapInfo.id.ToString()]; if (tooltipStrings == null) { return; } for (int i = 0; true; i++) { string num = i.ToString(); WzSubProperty tooltipString = (WzSubProperty)tooltipStrings[num]; WzSubProperty tooltipProp = (WzSubProperty)tooltipsParent[num]; WzSubProperty tooltipChar = (WzSubProperty)tooltipsParent[num + "char"]; if (tooltipString == null && tooltipProp == null) { break; } if (tooltipString == null ^ tooltipProp == null) { continue; } string title = InfoTool.GetOptionalString(tooltipString["Title"]); string desc = InfoTool.GetOptionalString(tooltipString["Desc"]); int x1 = InfoTool.GetInt(tooltipProp["x1"]); int x2 = InfoTool.GetInt(tooltipProp["x2"]); int y1 = InfoTool.GetInt(tooltipProp["y1"]); int y2 = InfoTool.GetInt(tooltipProp["y2"]); Microsoft.Xna.Framework.Rectangle tooltipPos = new Microsoft.Xna.Framework.Rectangle(x1, y1, x2 - x1, y2 - y1); ToolTipInstance tt = new ToolTipInstance(mapBoard, tooltipPos, title, desc, i); mapBoard.BoardItems.ToolTips.Add(tt); if (tooltipChar != null) { x1 = InfoTool.GetInt(tooltipChar["x1"]); x2 = InfoTool.GetInt(tooltipChar["x2"]); y1 = InfoTool.GetInt(tooltipChar["y1"]); y2 = InfoTool.GetInt(tooltipChar["y2"]); tooltipPos = new Microsoft.Xna.Framework.Rectangle(x1, y1, x2 - x1, y2 - y1); ToolTipChar ttc = new ToolTipChar(mapBoard, tooltipPos, tt); mapBoard.BoardItems.CharacterToolTips.Add(ttc); } } }
private void HandleStance(string pDir, WzSubProperty pProp, string pPrepend = "") { if (pProp == null) { return; } ExportAnimatedObject(pDir, pProp, pPrepend); }
private void LoadChairs(WzImage mapImage, Board mapBoard) { WzSubProperty chairParent = (WzSubProperty)mapImage["seat"]; if (chairParent != null) { foreach (WzVectorProperty chair in chairParent.WzProperties) { mapBoard.BoardItems.Chairs.Add(new Chair(mapBoard, chair.X.Value, chair.Y.Value)); } } mapBoard.BoardItems.Chairs.Sort(new Comparison <Chair>( delegate(Chair a, Chair b) { if (a.X > b.X) { return(1); } else if (a.X < b.X) { return(-1); } else { if (a.Y > b.Y) { return(1); } else if (a.Y < b.Y) { return(-1); } else { return(0); } } })); for (int i = 0; i < mapBoard.BoardItems.Chairs.Count - 1; i++) { Chair a = mapBoard.BoardItems.Chairs[i]; Chair b = mapBoard.BoardItems.Chairs[i + 1]; if (a.Y == b.Y && a.X == b.X) //removing b is more comfortable because that way we don't need to decrease i { if (a.Parent == null && b.Parent != null) { mapBoard.BoardItems.Chairs.Remove(a); i--; } else { mapBoard.BoardItems.Chairs.Remove(b); } } } }
/// <summary> /// Tooltip /// </summary> /// <param name="texturePool"></param> /// <param name="farmFrameParent"></param> /// <param name="tooltip"></param> /// <param name="device"></param> /// <returns></returns> public static TooltipItem CreateTooltipFromProperty(TexturePool texturePool, WzSubProperty farmFrameParent, ToolTipInstance tooltip, GraphicsDevice device) { // Wz frames System.Drawing.Bitmap c = ((WzCanvasProperty)farmFrameParent?["c"])?.GetLinkedWzCanvasBitmap(); System.Drawing.Bitmap cover = ((WzCanvasProperty)farmFrameParent?["cover"])?.GetLinkedWzCanvasBitmap(); System.Drawing.Bitmap e = ((WzCanvasProperty)farmFrameParent?["e"])?.GetLinkedWzCanvasBitmap(); System.Drawing.Bitmap n = ((WzCanvasProperty)farmFrameParent?["n"])?.GetLinkedWzCanvasBitmap(); System.Drawing.Bitmap s = ((WzCanvasProperty)farmFrameParent?["s"])?.GetLinkedWzCanvasBitmap(); System.Drawing.Bitmap w = ((WzCanvasProperty)farmFrameParent?["w"])?.GetLinkedWzCanvasBitmap(); System.Drawing.Bitmap ne = ((WzCanvasProperty)farmFrameParent?["ne"])?.GetLinkedWzCanvasBitmap(); // top right System.Drawing.Bitmap nw = ((WzCanvasProperty)farmFrameParent?["nw"])?.GetLinkedWzCanvasBitmap(); // top left System.Drawing.Bitmap se = ((WzCanvasProperty)farmFrameParent?["se"])?.GetLinkedWzCanvasBitmap(); // bottom right System.Drawing.Bitmap sw = ((WzCanvasProperty)farmFrameParent?["sw"])?.GetLinkedWzCanvasBitmap(); // bottom left // tooltip property string title = tooltip.Title; string desc = tooltip.Desc; string renderText = string.Format("{0}{1}{2}", title, Environment.NewLine, desc); // Constants const string TOOLTIP_FONT = "Arial"; const float TOOLTIP_FONTSIZE = 9.25f; // thankie willified, ya'll be remembered forever here <3 //System.Drawing.Color color_bgFill = System.Drawing.Color.FromArgb(230, 17, 54, 82); // pre V patch (dark blue theme used post-bb), leave this here in case someone needs it System.Drawing.Color color_bgFill = System.Drawing.Color.FromArgb(255, 17, 17, 17); // post V patch (dark black theme used), use color picker on paint via image extracted from WZ if you need to get it System.Drawing.Color color_foreGround = System.Drawing.Color.White; const int WIDTH_PADDING = 10; const int HEIGHT_PADDING = 6; // Create using (System.Drawing.Font font = new System.Drawing.Font(TOOLTIP_FONT, TOOLTIP_FONTSIZE)) { System.Drawing.Graphics graphics_dummy = System.Drawing.Graphics.FromImage(new System.Drawing.Bitmap(1, 1)); // dummy image just to get the Graphics object for measuring string System.Drawing.SizeF tooltipSize = graphics_dummy.MeasureString(renderText, font); int effective_width = (int)tooltipSize.Width + WIDTH_PADDING; int effective_height = (int)tooltipSize.Height + HEIGHT_PADDING; System.Drawing.Bitmap bmp_tooltip = new System.Drawing.Bitmap(effective_width, effective_height); using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bmp_tooltip)) { // Frames and background UIFrameHelper.DrawUIFrame(graphics, color_bgFill, ne, nw, se, sw, e, w, n, s, c, effective_width, effective_height); // Text graphics.DrawString(renderText, font, new System.Drawing.SolidBrush(color_foreGround), WIDTH_PADDING / 2, HEIGHT_PADDING / 2); graphics.Flush(); } IDXObject dxObj = new DXObject(tooltip.X, tooltip.Y, bmp_tooltip.ToTexture2D(device), 0); TooltipItem item = new TooltipItem(tooltip, dxObj); return(item); } }
/// <summary> /// Map item /// </summary> /// <param name="texturePool"></param> /// <param name="source"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="mapCenterX"></param> /// <param name="mapCenterY"></param> /// <param name="device"></param> /// <param name="usedProps"></param> /// <param name="flip"></param> /// <returns></returns> public static MouseCursorItem CreateMouseCursorFromProperty(TexturePool texturePool, WzImageProperty source, int x, int y, GraphicsDevice device, ref List <WzObject> usedProps, bool flip) { WzSubProperty cursorCanvas = (WzSubProperty)source?["0"]; WzSubProperty cursorPressedCanvas = (WzSubProperty)source?["1"]; // click List <IDXObject> frames = LoadFrames(texturePool, cursorCanvas, x, y, device, ref usedProps); BaseDXDrawableItem clickedState = CreateMapItemFromProperty(texturePool, cursorPressedCanvas, 0, 0, new Point(0, 0), device, ref usedProps, false); return(new MouseCursorItem(frames, clickedState)); }
private void HandleInfoBlock(string pDir, WzSubProperty pProp, string pPrepend = "") { ExportIfExists(pDir, pProp["icon"], pPrepend); ExportIfExists(pDir, pProp["iconRaw"], pPrepend); ExportIfExists(pDir, pProp["iconD"], pPrepend); // Androids ExportIfExists(pDir, pProp["iconRawD"], pPrepend); SaveInfo(pProp["vslot"], pPrepend); SaveInfo(pProp["islot"], pPrepend); ItemInformation.Instance.HandleInfo(currentID, pProp); }
/// <summary> /// Gets a WzImageProperty from a path /// </summary> /// <param name="path">path to object</param> /// <returns>the selected WzImageProperty</returns> public IWzImageProperty GetFromPath(string path) { if (reader != null) { if (!parsed) { ParseImage(); } } string[] segments = path.Split(new char[1] { '/' }, System.StringSplitOptions.RemoveEmptyEntries); if (segments[0] == "..") { return(null); } //hack method of adding the properties WzSubProperty childProperties = new WzSubProperty(); childProperties.AddProperties(properties.ToArray()); IWzImageProperty ret = childProperties; for (int x = 0; x < segments.Length; x++) { bool foundChild = false; foreach (IWzImageProperty iwp in ret.WzProperties) { if (iwp.Name == segments[x]) { if (iwp.PropertyType == WzPropertyType.Extended) { ret = ((WzExtendedProperty)iwp).ExtendedProperty; } else { ret = iwp; } foundChild = true; break; } } if (!foundChild) { return(null); } } return(ret); }
internal void SaveImage(WzBinaryWriter writer) { if (reader != null && !parsed) { ParseImage(); } WzSubProperty imgProp = new WzSubProperty(); long startPos = writer.BaseStream.Position; imgProp.AddProperties(WzProperties); imgProp.WriteValue(writer); writer.StringCache.Clear(); size = (int)(writer.BaseStream.Position - startPos); }
public static string GetMapStreetName(WzSubProperty mapProp) { if (mapProp == null) { return(""); } WzStringProperty streetName = (WzStringProperty)mapProp["streetName"]; if (streetName == null) { return(""); } return(streetName.Value); }
public static WzCanvasProperty GetNpcImage(WzImage parentImage) { WzSubProperty standParent = (WzSubProperty)parentImage["stand"]; if (standParent != null) { WzCanvasProperty frame1 = (WzCanvasProperty)GetRealProperty(standParent["0"]); if (frame1 != null) { return(frame1); } } return(null); }
public static WzCanvasProperty GetReactorImage(WzImage parentImage) { WzSubProperty action0 = (WzSubProperty)parentImage["0"]; if (action0 != null) { WzCanvasProperty frame1 = (WzCanvasProperty)GetRealProperty(action0["0"]); if (frame1 != null) { return(frame1); } } return(null); }
public static WzSubProperty GetMapStringProp(string id) { id = RemoveLeadingZeros(id); WzImage mapNameParent = (WzImage)Program.WzManager.String["Map.img"]; foreach (WzSubProperty mapNameCategory in mapNameParent.WzProperties) { WzSubProperty mapNameDirectory = (WzSubProperty)mapNameCategory[id]; if (mapNameDirectory != null) { return(mapNameDirectory); } } return(null); }
public void LoadRopes(WzImage mapImage, Board mapBoard) { WzSubProperty ropeParent = (WzSubProperty)mapImage["ladderRope"]; foreach (WzSubProperty rope in ropeParent.WzProperties) { int x = InfoTool.GetInt(rope["x"]); int y1 = InfoTool.GetInt(rope["y1"]); int y2 = InfoTool.GetInt(rope["y2"]); bool uf = InfoTool.GetBool(rope["uf"]); int page = InfoTool.GetInt(rope["page"]); bool l = InfoTool.GetBool(rope["l"]); mapBoard.BoardItems.Ropes.Add(new Rope(mapBoard, x, y1, y2, l, page, uf)); } }
public void ExtractItems(WzSubProperty pSubProperty, string pTypeName = "item") { Console.WriteLine("Extracting items {0}", pSubProperty.Name); foreach (var key in pSubProperty.WzProperties.Where(val => { return(val is WzSubProperty && (val as WzSubProperty).WzProperties.Length != 0); })) { int id = Convert.ToInt32(key.Name); string name = key["name"].ToStringValue(); SQLStrings.Instance.AppendRow(pTypeName, id, "name", name); var desc = key["desc"]; if (desc != null) { SQLStrings.Instance.AppendRow(pTypeName, id, "desc", desc.ToStringValue()); } } }
public void ExtractPortals() { WzSubProperty portalParent = (WzSubProperty)this["map"]["MapHelper.img"]["portal"]; WzSubProperty editorParent = (WzSubProperty)portalParent["editor"]; for (int i = 0; i < editorParent.WzProperties.Count; i++) { WzCanvasProperty portal = (WzCanvasProperty)editorParent.WzProperties[i]; Program.InfoManager.PortalTypeById.Add(portal.Name); PortalInfo.Load(portal); } WzSubProperty gameParent = (WzSubProperty)portalParent["game"]; foreach (WzSubProperty portal in gameParent.WzProperties) { if (portal.WzProperties[0] is WzSubProperty) { Dictionary <string, Bitmap> images = new Dictionary <string, Bitmap>(); Bitmap defaultImage = null; foreach (WzSubProperty image in portal.WzProperties) { WzSubProperty portalContinue = (WzSubProperty)image["portalContinue"]; if (portalContinue == null) { continue; } Bitmap portalImage = portalContinue["0"].GetBitmap(); if (image.Name == "default") { defaultImage = portalImage; } else { images.Add(image.Name, portalImage); } } Program.InfoManager.GamePortals.Add(portal.Name, new PortalGameImageInfo(defaultImage, images)); } } for (int i = 0; i < Program.InfoManager.PortalTypeById.Count; i++) { Program.InfoManager.PortalIdByType[Program.InfoManager.PortalTypeById[i]] = i; } }