private void objL1ListBox_SelectedIndexChanged(object sender, EventArgs e) { lock (hcsm.MultiBoard) { if (objL1ListBox.SelectedItem == null) { return; } objImagesContainer.Controls.Clear(); WzImageProperty l1Prop = Program.InfoManager.ObjectSets[(string)objSetListBox.SelectedItem][(string)objL0ListBox.SelectedItem][(string)objL1ListBox.SelectedItem]; try { foreach (WzSubProperty l2Prop in l1Prop.WzProperties) { ObjectInfo info = ObjectInfo.Get((string)objSetListBox.SelectedItem, (string)objL0ListBox.SelectedItem, (string)objL1ListBox.SelectedItem, l2Prop.Name); ImageViewer item = objImagesContainer.Add(info.Image, l2Prop.Name, true); item.Tag = info; item.MouseDown += new MouseEventHandler(objItem_Click); item.MouseUp += new MouseEventHandler(ImageViewer.item_MouseUp); item.MaxHeight = UserSettings.ImageViewerHeight; item.MaxWidth = UserSettings.ImageViewerWidth; } }catch (InvalidCastException ex) { return; } } }
public ShipObject(Board board, SerializationForm json) : base(board, json) { flip = json.flip; x0 = json.x0; zVal = json.zval; tMove = json.tmove; shipKind = json.shipkind; baseInfo = ObjectInfo.Get(json.os, json.l0, json.l1, json.l2); }
public Healer(Board board, SerializationForm json) : base(board, json) { yMin = json.ymin; yMax = json.ymax; healMin = json.healmin; healMax = json.healmax; fall = json.fall; rise = json.rise; baseInfo = ObjectInfo.Get(json.os, json.l0, json.l1, json.l2); }
public ObjectInstance(Board board, SerializationForm json) : base(board, json) { baseInfo = ObjectInfo.Get(json.os, json.l0, json.l1, json.l2); flip = json.flip; _r = json.r; name = json.name; _hide = json.hide; _reactor = json.reactor; _flow = json.flow; _rx = json.rx; _ry = json.ry; _cx = json.cx; _cy = json.cy; tags = json.tags; if (json.quest != null) { questInfo = json.quest.ToList(); } }
internal virtual void HitTest() { invalidated = false; selectedObjectInfo = new ObjectInfo(); if (selectionPoint == Point.Empty || SelectableTypes == ContextElementTypes.None) { return; } Chart chart = ChartControl; if (chart == null) { return; } try { HitTestResult hitTestResult = null; if (SelectableTypes == ContextElementTypes.Any) { hitTestResult = chart.HitTest(SelectionPoint.X, SelectionPoint.Y); } else { foreach (ChartElementType hitOrder in GetHitOrderList()) { hitTestResult = chart.HitTest(SelectionPoint.X, SelectionPoint.Y, hitOrder); if (hitTestResult.Object != null) { break; } } } selectedObjectInfo = ObjectInfo.Get(hitTestResult, chart); } catch { chart.IsDesignMode(); } }
public virtual void HitTest() { this.invalidated = false; this.selectedObjectInfo = new ObjectInfo(); if (!(this.selectionPoint == Point.Empty) && this.SelectableTypes != 0) { Chart chart = this.ChartControl; if (chart != null) { try { HitTestResult hitTestResult = null; if (this.SelectableTypes == ContextElementTypes.Any) { hitTestResult = chart.HitTest(this.SelectionPoint.X, this.SelectionPoint.Y); } else { foreach (ChartElementType hitOrder in this.GetHitOrderList()) { hitTestResult = chart.HitTest(this.SelectionPoint.X, this.SelectionPoint.Y, hitOrder); if (hitTestResult.Object != null) { break; } } } this.selectedObjectInfo = ObjectInfo.Get(hitTestResult, chart); } catch { chart.IsDesignMode(); } } } }
public void LoadMisc(WzImage mapImage, Board mapBoard) { // All of the following properties are extremely esoteric features that only appear in a handful of maps. // They are implemented here for the sake of completeness, and being able to repack their maps without corruption. WzImageProperty clock = mapImage["clock"]; WzImageProperty ship = mapImage["shipObj"]; WzImageProperty area = mapImage["area"]; WzImageProperty healer = mapImage["healer"]; WzImageProperty pulley = mapImage["pulley"]; WzImageProperty BuffZone = mapImage["BuffZone"]; WzImageProperty swimArea = mapImage["swimArea"]; if (clock != null) { Clock clockInstance = new Clock(mapBoard, new Rectangle(InfoTool.GetInt(clock["x"]), InfoTool.GetInt(clock["y"]), InfoTool.GetInt(clock["width"]), InfoTool.GetInt(clock["height"]))); mapBoard.BoardItems.Add(clockInstance, false); } if (ship != null) { string objPath = InfoTool.GetString(ship["shipObj"]); string[] objPathParts = objPath.Split("/".ToCharArray()); string oS = WzInfoTools.RemoveExtension(objPathParts[objPathParts.Length - 4]); string l0 = objPathParts[objPathParts.Length - 3]; string l1 = objPathParts[objPathParts.Length - 2]; string l2 = objPathParts[objPathParts.Length - 1]; ObjectInfo objInfo = ObjectInfo.Get(oS, l0, l1, l2); ShipObject shipInstance = new ShipObject(objInfo, mapBoard, InfoTool.GetInt(ship["x"]), InfoTool.GetInt(ship["y"]), InfoTool.GetOptionalInt(ship["z"]), InfoTool.GetOptionalInt(ship["x0"]), InfoTool.GetInt(ship["tMove"]), InfoTool.GetInt(ship["shipKind"]), InfoTool.GetBool(ship["f"])); mapBoard.BoardItems.Add(shipInstance, false); } if (area != null) { foreach (WzImageProperty prop in area.WzProperties) { int x1 = InfoTool.GetInt(prop["x1"]); int x2 = InfoTool.GetInt(prop["x2"]); int y1 = InfoTool.GetInt(prop["y1"]); int y2 = InfoTool.GetInt(prop["y2"]); Area currArea = new Area(mapBoard, new Rectangle(Math.Min(x1, x2), Math.Min(y1, y2), Math.Abs(x2 - x1), Math.Abs(y2 - y1)), prop.Name); mapBoard.BoardItems.Add(currArea, false); } } if (healer != null) { string objPath = InfoTool.GetString(healer["healer"]); string[] objPathParts = objPath.Split("/".ToCharArray()); string oS = WzInfoTools.RemoveExtension(objPathParts[objPathParts.Length - 4]); string l0 = objPathParts[objPathParts.Length - 3]; string l1 = objPathParts[objPathParts.Length - 2]; string l2 = objPathParts[objPathParts.Length - 1]; ObjectInfo objInfo = ObjectInfo.Get(oS, l0, l1, l2); Healer healerInstance = new Healer(objInfo, mapBoard, InfoTool.GetInt(healer["x"]), InfoTool.GetInt(healer["yMin"]), InfoTool.GetInt(healer["yMax"]), InfoTool.GetInt(healer["healMin"]), InfoTool.GetInt(healer["healMax"]), InfoTool.GetInt(healer["fall"]), InfoTool.GetInt(healer["rise"])); mapBoard.BoardItems.Add(healerInstance, false); } if (pulley != null) { string objPath = InfoTool.GetString(pulley["pulley"]); string[] objPathParts = objPath.Split("/".ToCharArray()); string oS = WzInfoTools.RemoveExtension(objPathParts[objPathParts.Length - 4]); string l0 = objPathParts[objPathParts.Length - 3]; string l1 = objPathParts[objPathParts.Length - 2]; string l2 = objPathParts[objPathParts.Length - 1]; ObjectInfo objInfo = ObjectInfo.Get(oS, l0, l1, l2); Pulley pulleyInstance = new Pulley(objInfo, mapBoard, InfoTool.GetInt(pulley["x"]), InfoTool.GetInt(pulley["y"])); mapBoard.BoardItems.Add(pulleyInstance, false); } if (BuffZone != null) { foreach (WzImageProperty zone in BuffZone.WzProperties) { int x1 = InfoTool.GetInt(zone["x1"]); int x2 = InfoTool.GetInt(zone["x2"]); int y1 = InfoTool.GetInt(zone["y1"]); int y2 = InfoTool.GetInt(zone["y2"]); int id = InfoTool.GetInt(zone["ItemID"]); int interval = InfoTool.GetInt(zone["Interval"]); int duration = InfoTool.GetInt(zone["Duration"]); BuffZone currZone = new BuffZone(mapBoard, new Rectangle(Math.Min(x1, x2), Math.Min(y1, y2), Math.Abs(x2 - x1), Math.Abs(y2 - y1)), id, interval, duration, zone.Name); mapBoard.BoardItems.Add(currZone, false); } } if (swimArea != null) { foreach (WzImageProperty prop in swimArea.WzProperties) { int x1 = InfoTool.GetInt(prop["x1"]); int x2 = InfoTool.GetInt(prop["x2"]); int y1 = InfoTool.GetInt(prop["y1"]); int y2 = InfoTool.GetInt(prop["y2"]); SwimArea currArea = new SwimArea(mapBoard, new Rectangle(Math.Min(x1, x2), Math.Min(y1, y2), Math.Abs(x2 - x1), Math.Abs(y2 - y1)), prop.Name); mapBoard.BoardItems.Add(currArea, false); } } // Some misc items are not implemented here; these are copied byte-to-byte from the original. See VerifyMapPropsKnown for details. }
public void LoadLayers(WzImage mapImage, Board mapBoard) { for (int layer = 0; layer <= 7; layer++) { WzSubProperty layerProp = (WzSubProperty)mapImage[layer.ToString()]; WzImageProperty tSprop = layerProp["info"]["tS"]; string tS = null; if (tSprop != null) { tS = InfoTool.GetString(tSprop); } foreach (WzImageProperty obj in layerProp["obj"].WzProperties) { int x = InfoTool.GetInt(obj["x"]); int y = InfoTool.GetInt(obj["y"]); int z = InfoTool.GetInt(obj["z"]); int zM = InfoTool.GetInt(obj["zM"]); string oS = InfoTool.GetString(obj["oS"]); string l0 = InfoTool.GetString(obj["l0"]); string l1 = InfoTool.GetString(obj["l1"]); string l2 = InfoTool.GetString(obj["l2"]); string name = InfoTool.GetOptionalString(obj["name"]); MapleBool r = InfoTool.GetOptionalBool(obj["r"]); MapleBool hide = InfoTool.GetOptionalBool(obj["hide"]); MapleBool reactor = InfoTool.GetOptionalBool(obj["reactor"]); MapleBool flow = InfoTool.GetOptionalBool(obj["flow"]); int? rx = InfoTool.GetOptionalTranslatedInt(obj["rx"]); int? ry = InfoTool.GetOptionalTranslatedInt(obj["ry"]); int? cx = InfoTool.GetOptionalTranslatedInt(obj["cx"]); int? cy = InfoTool.GetOptionalTranslatedInt(obj["cy"]); string tags = InfoTool.GetOptionalString(obj["tags"]); WzImageProperty questParent = obj["quest"]; List <ObjectInstanceQuest> questInfo = null; if (questParent != null) { questInfo = new List <ObjectInstanceQuest>(); foreach (WzIntProperty info in questParent.WzProperties) { questInfo.Add(new ObjectInstanceQuest(int.Parse(info.Name), (QuestState)info.Value)); } } bool flip = InfoTool.GetBool(obj["f"]); ObjectInfo objInfo = ObjectInfo.Get(oS, l0, l1, l2); if (objInfo == null) { continue; } Layer l = mapBoard.Layers[layer]; mapBoard.BoardItems.TileObjs.Add((LayeredItem)objInfo.CreateInstance(l, mapBoard, x, y, z, zM, r, hide, reactor, flow, rx, ry, cx, cy, name, tags, questInfo, flip, false)); l.zMList.Add(zM); } WzImageProperty tileParent = layerProp["tile"]; foreach (WzImageProperty tile in tileParent.WzProperties) { int x = InfoTool.GetInt(tile["x"]); int y = InfoTool.GetInt(tile["y"]); int zM = InfoTool.GetInt(tile["zM"]); string u = InfoTool.GetString(tile["u"]); int no = InfoTool.GetInt(tile["no"]); Layer l = mapBoard.Layers[layer]; TileInfo tileInfo = TileInfo.Get(tS, u, no.ToString()); mapBoard.BoardItems.TileObjs.Add((LayeredItem)tileInfo.CreateInstance(l, mapBoard, x, y, int.Parse(tile.Name), zM, false, false)); l.zMList.Add(zM); } } }
public Pulley(Board board, SerializationForm json) : base(board, json) { baseInfo = ObjectInfo.Get(json.os, json.l0, json.l1, json.l2); }