public FootholdLine(Board board, MapleDot firstDot, MapleBool forbidFallDown, MapleBool cantThrough, int?piece, int?force) : base(board, firstDot) { this._cantThrough = cantThrough; this._forbidFallDown = forbidFallDown; this._piece = piece; this._force = force; }
public FootholdLine(Board board, MapleDot firstDot, MapleDot secondDot) : base(board, firstDot, secondDot) { this._cantThrough = null; this._forbidFallDown = null; this._piece = null; this._force = null; }
public FootholdLine(Board board, MapleDot firstDot) : base(board, firstDot) { _cantThrough = null; _forbidFallDown = null; _piece = null; _force = null; }
public FootholdLine(Board board, SerializationForm json) : base(board) { _cantThrough = json.cantthrough; _forbidFallDown = json.forbidfalldown; _piece = json.piece; _force = json.force; }
public LifeInstance(Board board, SerializationForm json) : base(board, json) { _rx0Shift = json.rx0; _rx1Shift = json.rx1; _yShift = json.yshift; mobTime = json.mobtime; flip = json.flip; hide = json.hide; info = json.info; team = json.team; }
public void LoadLife(WzImage mapImage, Board mapBoard) { WzImageProperty lifeParent = mapImage["life"]; if (lifeParent == null) { return; } foreach (WzSubProperty life in lifeParent.WzProperties) { string id = InfoTool.GetString(life["id"]); int x = InfoTool.GetInt(life["x"]); int y = InfoTool.GetInt(life["y"]); int cy = InfoTool.GetInt(life["cy"]); int? mobTime = InfoTool.GetOptionalInt(life["mobTime"]); int? info = InfoTool.GetOptionalInt(life["info"]); int? team = InfoTool.GetOptionalInt(life["team"]); int rx0 = InfoTool.GetInt(life["rx0"]); int rx1 = InfoTool.GetInt(life["rx1"]); MapleBool flip = InfoTool.GetOptionalBool(life["f"]); MapleBool hide = InfoTool.GetOptionalBool(life["hide"]); string type = InfoTool.GetString(life["type"]); string limitedname = InfoTool.GetOptionalString(life["limitedname"]); switch (type) { case "m": MobInfo mobInfo = MobInfo.Get(id); if (mobInfo == null) { continue; } mapBoard.BoardItems.Mobs.Add((MobInstance)mobInfo.CreateInstance(mapBoard, x, cy, x - rx0, rx1 - x, cy - y, limitedname, mobTime, flip, hide, info, team)); break; case "n": NpcInfo npcInfo = NpcInfo.Get(id); if (npcInfo == null) { continue; } mapBoard.BoardItems.NPCs.Add((NpcInstance)npcInfo.CreateInstance(mapBoard, x, cy, x - rx0, rx1 - x, cy - y, limitedname, mobTime, flip, hide, info, team)); break; default: throw new Exception("invalid life type " + type); } } }
private int?team; //for carnival public LifeInstance(MapleDrawableInfo baseInfo, Board board, int x, int y, int rx0Shift, int rx1Shift, int yShift, string limitedname, int?mobTime, MapleBool flip, MapleBool hide, int?info, int?team) : base(board, x, y, -1) { this.limitedname = limitedname; this._rx0Shift = rx0Shift; this._rx1Shift = rx1Shift; this._yShift = yShift; this.mobTime = mobTime; this.info = info; this.team = team; this.flip = flip; if (flip == true) { // We need to use the data from baseInfo directly because BaseInfo property is only instantiated in the child ctor, // which will execute after we are finished. X -= baseInfo.Width - 2 * baseInfo.Origin.X; } }
public PortalInstance(PortalInfo baseInfo, Board board, int x, int y, string pn, string pt, string tn, int tm, string script, int?delay, MapleBool hideTooltip, MapleBool onlyOnce, int?horizontalImpact, int?verticalImpact, string image, int?hRange, int?vRange) : base(board, x, y, -1) { this.baseInfo = baseInfo; _pn = pn; _pt = pt; _tn = tn; _tm = tm; _script = script; _delay = delay; _hideTooltip = hideTooltip; _onlyOnce = onlyOnce; _horizontalImpact = horizontalImpact; _verticalImpact = verticalImpact; _image = image; _hRange = hRange; _vRange = vRange; }
public PortalInstance(Board board, SerializationForm json) : base(board, json) { _pn = json.pn; _pt = json.pt; _tn = json.tn; _tm = json.tm; _script = json.script; _delay = json.delay; _hideTooltip = json.hidett; _onlyOnce = json.onlyonce; _horizontalImpact = json.himpact; _verticalImpact = json.vimpact; _image = json.image; _hRange = json.hrange; _vRange = json.vrange; baseInfo = PortalInfo.GetPortalInfoByType(pt); }
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(); } }
public ObjectInstance(ObjectInfo baseInfo, Layer layer, Board board, int x, int y, int z, int zM, MapleBool r, MapleBool hide, MapleBool reactor, MapleBool flow, int?rx, int?ry, int?cx, int?cy, string name, string tags, List <ObjectInstanceQuest> questInfo, bool flip) : base(board, layer, zM, x, y, z) { this.baseInfo = baseInfo; this.flip = flip; this._r = r; this.name = name; this._hide = hide; this._reactor = reactor; this._flow = flow; this._rx = rx; this._ry = ry; this._cx = cx; this._cy = cy; this._tags = tags; this.questInfo = questInfo; if (flip) { X -= Width - 2 * Origin.X; } }
private int?team; //for carnival public LifeInstance(MapleDrawableInfo baseInfo, string type, Board board, int x, int y, int rx0, int rx1, string limitedname, int?mobTime, MapleBool flip, MapleBool hide, int?info, int?team, bool beforeAdding) : base(board, x, y, -1, beforeAdding) { if (type != "m" && type != "n") { throw new NotSupportedException("Unknown life type @ LifeInstance..ctor"); } this.limitedname = limitedname; this.type = type; this.baseInfo = baseInfo; this._rx0 = rx0; this._rx1 = rx1; this.mobTime = mobTime; this.info = info; this.team = team; this.flip = flip; if (flip == true) { X -= Width - 2 * Origin.X; } }
public void LoadPortals(WzImage mapImage, Board mapBoard) { WzSubProperty portalParent = (WzSubProperty)mapImage["portal"]; foreach (WzSubProperty portal in portalParent.WzProperties) { int x = InfoTool.GetInt(portal["x"]); int y = InfoTool.GetInt(portal["y"]); string pt = Program.InfoManager.PortalTypeById[InfoTool.GetInt(portal["pt"])]; int tm = InfoTool.GetInt(portal["tm"]); string tn = InfoTool.GetString(portal["tn"]); string pn = InfoTool.GetString(portal["pn"]); string image = InfoTool.GetOptionalString(portal["image"]); string script = InfoTool.GetOptionalString(portal["script"]); int? verticalImpact = InfoTool.GetOptionalInt(portal["verticalImpact"]); int? horizontalImpact = InfoTool.GetOptionalInt(portal["horizontalImpact"]); int? hRange = InfoTool.GetOptionalInt(portal["hRange"]); int? vRange = InfoTool.GetOptionalInt(portal["vRange"]); int? delay = InfoTool.GetOptionalInt(portal["delay"]); MapleBool hideTooltip = InfoTool.GetOptionalBool(portal["hideTooltip"]); MapleBool onlyOnce = InfoTool.GetOptionalBool(portal["onlyOnce"]); mapBoard.BoardItems.Portals.Add(PortalInfo.GetPortalInfoByType(pt).CreateInstance(mapBoard, x, y, pn, tn, tm, script, delay, hideTooltip, onlyOnce, horizontalImpact, verticalImpact, image, hRange, vRange)); } }
private static void LoadLayers(WzImage mapImage, Board mapBoard) { for (int layer = 0; layer <= 7; layer++) { WzSubProperty layerProp = (WzSubProperty)mapImage[layer.ToString()]; IWzImageProperty tSprop = layerProp["info"]["tS"]; string tS = null; if (tSprop != null) { tS = InfoTool.GetString(tSprop); } foreach (IWzImageProperty 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"]); IWzImageProperty questParent = obj["quest"]; List <ObjectInstanceQuest> questInfo = null; if (questParent != null) { foreach (WzCompressedIntProperty info in questParent.WzProperties) { questInfo.Add(new ObjectInstanceQuest(int.Parse(info.Name), (QuestState)info.Value)); } } bool flip = InfoTool.GetBool(obj["f"]); IWzImageProperty objInfoProp = Program.InfoManager.ObjectSets[oS][l0][l1][l2]; if (objInfoProp.HCTag == null) { objInfoProp.HCTag = ObjectInfo.Load((WzSubProperty)objInfoProp, oS, l0, l1, l2); } ObjectInfo objInfo = (ObjectInfo)objInfoProp.HCTag; mapBoard.BoardItems.TileObjs.Add((LayeredItem)objInfo.CreateInstance(mapBoard.Layers[layer], mapBoard, x, y, z, r, hide, reactor, flow, rx, ry, cx, cy, name, tags, questInfo, flip, false, false)); } IWzImageProperty tileParent = layerProp["tile"]; for (int i = 0; i < tileParent.WzProperties.Count; i++) //foreach (IWzImageProperty tile in layerProp["tile"].WzProperties) { IWzImageProperty tile = tileParent.WzProperties[i]; 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"]); IWzImageProperty tileInfoProp = Program.InfoManager.TileSets[tS][u][no.ToString()]; if (tileInfoProp.HCTag == null) { tileInfoProp.HCTag = TileInfo.Load((WzCanvasProperty)tileInfoProp, tS, u, no.ToString()); } TileInfo tileInfo = (TileInfo)tileInfoProp.HCTag; mapBoard.BoardItems.TileObjs.Add((LayeredItem)tileInfo.CreateInstance(mapBoard.Layers[layer], mapBoard, x, y, i /*zM*/, false, false, false)); } } }
public BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, int zM, MapleBool r, MapleBool hide, MapleBool reactor, MapleBool flow, int?rx, int?ry, int?cx, int?cy, string name, string tags, List <ObjectInstanceQuest> questInfo, bool flip, bool parseOffsets) { ObjectInstance instance = new ObjectInstance(this, layer, board, x, y, z, zM, r, hide, reactor, flow, rx, ry, cx, cy, name, tags, questInfo, flip); if (parseOffsets) { ParseOffsets(instance, board, x, y); } return(instance); }
public BoardItem CreateInstance(Board board, int x, int y, int rx0Shift, int rx1Shift, int yShift, string limitedname, int?mobTime, MapleBool flip, MapleBool hide, int?info, int?team) { if (Image == null) { ParseImage(); } return(new NpcInstance(this, board, x, y, rx0Shift, rx1Shift, yShift, limitedname, mobTime, flip, hide, info, team)); }
public void LoadFootholds(WzImage mapImage, Board mapBoard) { List <FootholdAnchor> anchors = new List <FootholdAnchor>(); WzSubProperty footholdParent = (WzSubProperty)mapImage["foothold"]; int layer; FootholdAnchor a; FootholdAnchor b; Dictionary <int, FootholdLine> fhs = new Dictionary <int, FootholdLine>(); foreach (WzSubProperty layerProp in footholdParent.WzProperties) { layer = int.Parse(layerProp.Name); Layer l = mapBoard.Layers[layer]; foreach (WzSubProperty platProp in layerProp.WzProperties) { int zM = int.Parse(platProp.Name); l.zMList.Add(zM); foreach (WzSubProperty fhProp in platProp.WzProperties) { a = new FootholdAnchor(mapBoard, InfoTool.GetInt(fhProp["x1"]), InfoTool.GetInt(fhProp["y1"]), layer, zM, false); b = new FootholdAnchor(mapBoard, InfoTool.GetInt(fhProp["x2"]), InfoTool.GetInt(fhProp["y2"]), layer, zM, false); int num = int.Parse(fhProp.Name); int next = InfoTool.GetInt(fhProp["next"]); int prev = InfoTool.GetInt(fhProp["prev"]); MapleBool cantThrough = InfoTool.GetOptionalBool(fhProp["cantThrough"]); MapleBool forbidFallDown = InfoTool.GetOptionalBool(fhProp["forbidFallDown"]); int? piece = InfoTool.GetOptionalInt(fhProp["piece"]); int? force = InfoTool.GetOptionalInt(fhProp["force"]); if (a.X != b.X || a.Y != b.Y) { FootholdLine fh = new FootholdLine(mapBoard, a, b, forbidFallDown, cantThrough, piece, force); fh.num = num; fh.prev = prev; fh.next = next; mapBoard.BoardItems.FootholdLines.Add(fh); fhs[num] = fh; anchors.Add(a); anchors.Add(b); } } } anchors.Sort(new Comparison <FootholdAnchor>(FootholdAnchor.FHAnchorSorter)); for (int i = 0; i < anchors.Count - 1; i++) { a = anchors[i]; b = anchors[i + 1]; if (a.X == b.X && a.Y == b.Y) { FootholdAnchor.MergeAnchors(a, b); // Transfer lines from b to a anchors.RemoveAt(i + 1); // Remove b i--; // Fix index after we removed b } } foreach (FootholdAnchor anchor in anchors) { if (anchor.connectedLines.Count > 2) { foreach (FootholdLine line in anchor.connectedLines) { if (IsAnchorPrevOfFoothold(anchor, line)) { if (fhs.ContainsKey(line.prev)) { line.prevOverride = fhs[line.prev]; } } else { if (fhs.ContainsKey(line.next)) { line.nextOverride = fhs[line.next]; } } } } mapBoard.BoardItems.FHAnchors.Add(anchor); } anchors.Clear(); } }
private static void LoadLife(WzImage mapImage, Board mapBoard) { IWzImageProperty lifeParent = mapImage["life"]; if (lifeParent == null) { return; } foreach (WzSubProperty life in lifeParent.WzProperties) { string id = InfoTool.GetString(life["id"]); int x = InfoTool.GetInt(life["x"]); //int y = InfoTool.GetInt(life["y"]); int cy = InfoTool.GetInt(life["cy"]); int? mobTime = InfoTool.GetOptionalInt(life["mobTime"]); int? info = InfoTool.GetOptionalInt(life["info"]); int? team = InfoTool.GetOptionalInt(life["team"]); int rx0 = InfoTool.GetInt(life["rx0"]); int rx1 = InfoTool.GetInt(life["rx1"]); MapleBool flip = InfoTool.GetOptionalBool(life["f"]); MapleBool hide = InfoTool.GetOptionalBool(life["hide"]); string type = InfoTool.GetString(life["type"]); string limitedname = InfoTool.GetOptionalString(life["limitedname"]); switch (type) { case "m": WzImage mobImage = (WzImage)Program.WzManager["mob"][id + ".img"]; if (!mobImage.Parsed) { mobImage.ParseImage(); } if (mobImage.HCTag == null) { mobImage.HCTag = MobInfo.Load(mobImage); } MobInfo mobInfo = (MobInfo)mobImage.HCTag; //mapBoard.BoardItems.Mobs.Add((MobInstance)mobInfo.CreateInstance(mapBoard, x, cy, rx0, rx1, mobTime, flip, hide, false)); mapBoard.BoardItems.Mobs.Add((LifeInstance)mobInfo.CreateInstance(mapBoard, x, cy, rx0, rx1, limitedname, mobTime, flip, hide, info, team, false)); break; case "n": WzImage npcImage = (WzImage)Program.WzManager["npc"][id + ".img"]; if (!npcImage.Parsed) { npcImage.ParseImage(); } if (npcImage.HCTag == null) { npcImage.HCTag = NpcInfo.Load(npcImage); } NpcInfo npcInfo = (NpcInfo)npcImage.HCTag; //mapBoard.BoardItems.NPCs.Add((NpcInstance)npcInfo.CreateInstance(mapBoard, x, cy, rx0, rx1, mobTime, flip, hide, false)); mapBoard.BoardItems.NPCs.Add((LifeInstance)npcInfo.CreateInstance(mapBoard, x, cy, rx0, rx1, limitedname, mobTime, flip, hide, info, team, false)); break; default: throw new Exception("invalid life type " + type); } } }
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 BoardItem CreateInstance(Board board, int x, int y, int rx0, int rx1, string limitedname, int?mobTime, MapleBool flip, MapleBool hide, int?info, int?team, bool beforeAdding) { if (Image == null) { ParseImage(); } return(new LifeInstance(this, "n", board, x, y, x - UserSettings.Mobrx0Offset, x + UserSettings.Mobrx1Offset, limitedname, mobTime, flip, hide, info, team, beforeAdding)); }
public PortalInstance CreateInstance(Board board, int x, int y, string pn, string tn, int tm, string script, int?delay, MapleBool hideTooltip, MapleBool onlyOnce, int?horizontalImpact, int?verticalImpact, string image, int?hRange, int?vRange) { return(new PortalInstance(this, board, x, y, pn, type, tn, tm, script, delay, hideTooltip, onlyOnce, horizontalImpact, verticalImpact, image, hRange, vRange)); }
public NpcInstance(NpcInfo baseInfo, Board board, int x, int y, int rx0Shift, int rx1Shift, int yShift, string limitedname, int?mobTime, MapleBool flip, MapleBool hide, int?info, int?team) : base(baseInfo, board, x, y, rx0Shift, rx1Shift, yShift, limitedname, mobTime, flip, hide, info, team) { this.baseInfo = baseInfo; }