// Consume/0287.img/0{CardID}/info/grade public string GetRarity(int cardID) { WzImage image = ConsumeDirectory.GetImageByName("0287.img"); int familiarRarityID = image.GetFromPath($@"0{cardID}/info/grade")?.GetInt() ?? -1; string familiarRarity = ""; switch (familiarRarityID) { case 0: familiarRarity = "Common"; break; case 1: familiarRarity = "Rare"; break; case 2: familiarRarity = "Epic"; break; case 3: familiarRarity = "Unique"; break; } return(familiarRarity); }
// {category}/{EquipImage}/info/icon public Bitmap GetEquipImage(WzFile characterWZ) { if (EquipImage == null) { return(null); } Bitmap weaponImage = null; if (EquipImage?.GetFromPath($@"info/icon/_outlink") == null && EquipImage?.GetFromPath($@"info/icon/_inlink") == null) { weaponImage = EquipImage?.GetFromPath($@"info/icon").GetBitmap(); } else if (EquipImage?.GetFromPath($@"info/icon/_outlink") != null) { string outlink = EquipImage?.GetFromPath($@"info/icon/_outlink").GetString(); string treatedlink = outlink.Substring(outlink.IndexOf("/") + 1); string directoryName = treatedlink.Substring(0, treatedlink.IndexOf("/")); treatedlink = treatedlink.Substring(treatedlink.IndexOf("/") + 1); int newWeaponID = Convert.ToInt32(treatedlink.Substring(0, treatedlink.IndexOf("."))); string remainderlink = treatedlink.Substring(treatedlink.IndexOf("/") + 1); WzDirectory directory = characterWZ.WzDirectory.GetDirectoryByName(directoryName); WzImage newWeaponImage = directory.GetImageByName($@"0{newWeaponID}.img"); weaponImage = newWeaponImage?.GetFromPath($@"{remainderlink}").GetBitmap(); } else { string inlink = EquipImage?.GetFromPath($@"info/icon/_inlink").GetString(); weaponImage = EquipImage?.GetFromPath($@"{inlink}").GetBitmap(); } return(weaponImage); }
public override WzImageProperty GetInfoPropertyById(Dictionary <string, WzFile> wzFiles, string id) { // pets are special for some reason // Item.wz/Pet/02000000.img WzDirectory dir = wzFiles["Item.wz"].WzDirectory[Name] as WzDirectory; WzImage petImg = dir.GetImageByName(id + ".img"); return(petImg["info"]); }
public override WzImageProperty GetInfoPropertyById(Dictionary <string, WzFile> wzFiles, string id) { // Ins -> Install string paddedId = "0" + id; WzDirectory dir = wzFiles["Item.wz"].WzDirectory["Install"] as WzDirectory; WzImage itemImg = dir.GetImageByName(paddedId.Substring(0, 4) + ".img"); return(itemImg[paddedId]["info"]); }
public override WzImageProperty GetInfoPropertyById(Dictionary <string, WzFile> wzFiles, string id) { // Character.wz/Accessory/01010000.img string paddedId = "0" + id; WzDirectory dir = wzFiles["Character.wz"].WzDirectory[Name] as WzDirectory; WzImage itemImg = dir.GetImageByName(paddedId + ".img"); return(itemImg["info"]); }
// {mobID}.img/stand/0 DON'T CONFUSE THE DIFFERENT MOBIMAGES public Bitmap GetMobImage() { if (MobImage == null) { return(null); } Bitmap mobImage = null; string thumbnailPath; if (MobImage?.GetFromPath($@"info/thumbnail") != null) { mobImage = MobImage?.GetFromPath($@"info/thumbnail").GetBitmap(); return(mobImage); } else if (MobImage?.GetFromPath($@"stand/0") != null) { thumbnailPath = "stand"; } else if (MobImage?.GetFromPath($@"fly/0") != null) { thumbnailPath = "fly"; } else { return(null); } if (MobImage?.GetFromPath($@"{thumbnailPath}/0/_outlink") == null && MobImage?.GetFromPath($@"{thumbnailPath}/0/_inlink") == null) { mobImage = MobImage?.GetFromPath($@"{thumbnailPath}/0").GetBitmap(); } else if (MobImage?.GetFromPath($@"{thumbnailPath}/0/_outlink") != null) { string outlink = MobImage?.GetFromPath($@"{thumbnailPath}/0/_outlink").GetString(); string treatedlink = outlink.Substring(outlink.IndexOf("/") + 1); int newMobID = Convert.ToInt32(treatedlink.Substring(0, treatedlink.IndexOf("."))); string remainderlink = treatedlink.Substring(treatedlink.IndexOf("/") + 1); WzImage newMobImage = MobDirectory.GetImageByName($@"{newMobID}.img"); mobImage = newMobImage?.GetFromPath($@"{remainderlink}").GetBitmap(); } else { string inlink = MobImage?.GetFromPath($@"{thumbnailPath}/0/_inlink").GetString(); mobImage = MobImage?.GetFromPath($@"{inlink}").GetBitmap(); } return(mobImage); }
public override void Start() { WzFile file = MapleFileCache.Instance["Etc"]; WzDirectory familiarscwz = MapleFileCache.Instance["Character"].GetObjectFromPath("Character.wz/Familiar") as WzDirectory; if (familiarscwz != null) { WzFile mobfile = MapleFileCache.Instance["Mob"]; familiarscwz.ParseImages(); string familiarDir = exDir + "Character" + Path.DirectorySeparatorChar + "Familiar" + Path.DirectorySeparatorChar; //if (false) { foreach (WzSubProperty prop in (file.WzDirectory["FamiliarInfo.img"] as WzImage).WzProperties) { int famid = int.Parse(prop.Name); int mobid = prop["mob"].ToInt(); string tempdir = familiarDir + string.Format("{0:D7}.img", famid) + Path.DirectorySeparatorChar; WzSubProperty charwzProp = familiarscwz.GetImageByName(string.Format("{0}.img", famid))["info"] as WzSubProperty; WzSubProperty skillSubProp = prop["skill"] as WzSubProperty; FamiliarInfoSQL.Instance.AddFamiliar(famid, prop["consume"].ToInt(), mobid, charwzProp["grade"].ToInt(), charwzProp["range"].ToInt(), skillSubProp == null ? 0 : skillSubProp["id"].ToInt()); // Export images, too WzImage mobimg = mobfile.WzDirectory[string.Format("{0:D7}.img", mobid)] as WzImage; if (mobimg["info"] != null && mobimg["info"]["link"] != null) { // --- Console.WriteLine("Nekson leik links"); mobimg = mobfile.WzDirectory[string.Format("{0:D7}.img", mobimg["info"]["link"].ToInt())] as WzImage; } if (mobimg["stand"] != null) { WzSubProperty subprop = mobimg["stand"] as WzSubProperty; ExportIfExists(tempdir, subprop["0"], "stand"); foreach (var prop2 in subprop["0"].WzProperties) { ExportIfExists(tempdir, prop2, "stand.0"); } } else if (mobimg["fly"] != null) { WzSubProperty subprop = mobimg["fly"] as WzSubProperty; ExportIfExists(tempdir, subprop["0"], "stand"); foreach (var prop2 in subprop["0"].WzProperties) { ExportIfExists(tempdir, prop2, "stand.0"); } } } } } this.currentID = 90000000; foreach (WzSubProperty prop in (file.WzDirectory["SetItemInfo.img"] as WzImage).WzProperties) { ExportProps(prop, prop.Name); } }
public void SetFamiliarImage(int familiarID) { FamiliarImage = FamiliarDirectory.GetImageByName($@"{familiarID}.img"); }
public void patch(Dictionary <String, List <String> > patches, string dir, int patchNum) { WzMapleVersion vrs = WzMapleVersion.GMS; foreach (String wzName in patches.Keys) { WzFile wzFile = null; foreach (WzFile patching in toPatch) { if (patching.Name == wzName) { Console.WriteLine("Currently patching: {0}, nextToPatch: {1}", patching.Name, wzName); wzFile = patching; break; } } if (wzFile == null) { wzFile = new WzFile(wzName, vrs); wzFile.ParseWzFile(); } foreach (string img in patches[wzName]) { WzImage patchedImg = null; string[] subdirs = img.Split(new char[] { '/' }); WzDirectory targetDir = wzFile.WzDirectory; string targetImgName = null; foreach (string subdir in subdirs) { Console.WriteLine("subdir: {0}", subdir); if (!subdir.EndsWith(".img")) // if this isn't the img { targetDir = targetDir.GetDirectoryByName(subdir); if (targetDir == null) { Console.WriteLine("ERROR: {0} is not a valid directory.", subdir); return; } } else { targetImgName = subdir; } } patchedImg = new WzImage(targetImgName, File.OpenRead(dir + "-" + patchNum + targetImgName), vrs); patchedImg.ParseImage(); WzImage targetImg = targetDir.GetImageByName(targetImgName); if (targetImg != null) // patching an existing .img { targetDir.RemoveImage(targetImg); targetDir.AddImage(patchedImg); patchedImg.changed = true; Console.WriteLine("Existing wz img found for name: {0} and successfully applied patch.", img); } else { targetDir.AddImage(patchedImg); patchedImg.changed = true; Console.WriteLine("Added new wz img with name: {0} in dir: {1} and sucessfully applied patch.", patchedImg.Name, targetDir.Name); } } if (!toPatch.Contains(wzFile)) { toPatch.Add(wzFile); } } }
public ItemWz(WzFile itemWZ) { itemWZ.ParseWzFile(); ConsumeDirectory = itemWZ.WzDirectory.GetDirectoryByName("Consume"); ConsumeImage = ConsumeDirectory.GetImageByName("0286.img"); }