- Joined
- May 19, 2008
- Messages
- 124
- Reaction score
- 1
ZOMG,You Guys Are Freakin Clever!You Guys uses VC Or C# ?
no such thing as VC#...
hint its something
think TitainMS
no, what your thinking is C++ and no thats not right. we are talking C#. i would advise read past posts in this thread to keep up ^_^
it does work but they would have to be png and renders.
i know this because of MapleDump and they always extracted it has a render
using WzLib;
this is not to edit the client... this is to edit the wz files itself...
as for putting them into the program. i thinks it done by requesting them like import for java. not to sure for im no C# coder. but looking at the ex someone posted it looks like
Code:using WzLib;
put that in the header of the app along with the others
Error 1 The type or namespace name 'WzLib' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Ryan\Local Settings\Application Data\Temporary Projects\Repacker\Program.cs 6 7 Repacker
Error 2 The type or namespace name 'WzFile' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Ryan\Local Settings\Application Data\Temporary Projects\Repacker\Program.cs 133 17 Repacker
Error 3 The type or namespace name 'WzImage' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Ryan\Local Settings\Application Data\Temporary Projects\Repacker\Program.cs 157 22 Repacker
Error 4 The type or namespace name 'WzDirectory' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Ryan\Local Settings\Application Data\Temporary Projects\Repacker\Program.cs 285 54 Repacker
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using WzLib;
namespace Footholds
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
public partial class MainForm : Form
{
#region Form design code
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.cbx_MapleType = new System.Windows.Forms.ComboBox();
this.tbx_Path = new System.Windows.Forms.TextBox();
this.btn_OpenMapWz = new System.Windows.Forms.Button();
this.tvw_Map_List = new System.Windows.Forms.TreeView();
this.pbx_Foothold_Render = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbx_Foothold_Render)).BeginInit();
this.SuspendLayout();
//
// cbx_MapleType
//
this.cbx_MapleType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbx_MapleType.FormattingEnabled = true;
this.cbx_MapleType.Items.AddRange(new object[] {
"GMS",
"EMS",
"BMS"});
this.cbx_MapleType.Location = new System.Drawing.Point(13, 13);
this.cbx_MapleType.Name = "cbx_MapleType";
this.cbx_MapleType.Size = new System.Drawing.Size(55, 21);
this.cbx_MapleType.TabIndex = 0;
//
// tbx_Path
//
this.tbx_Path.Location = new System.Drawing.Point(74, 14);
this.tbx_Path.Name = "tbx_Path";
this.tbx_Path.Size = new System.Drawing.Size(4*** 20);
this.tbx_Path.TabIndex = 1;
//
// btn_OpenMapWz
//
this.btn_OpenMapWz.Location = new System.Drawing.Point(576, 12);
this.btn_OpenMapWz.Name = "btn_OpenMapWz";
this.btn_OpenMapWz.Size = new System.Drawing.Size(75, 23);
this.btn_OpenMapWz.TabIndex = 2;
this.btn_OpenMapWz.Text = "Open";
this.btn_OpenMapWz.UseVisualStyleBackColor = true;
this.btn_OpenMapWz.Click += new System.EventHandler(this.btn_OpenMapWz_Click);
//
// tvw_Map_List
//
this.tvw_Map_List.Location = new System.Drawing.Point(13, 41);
this.tvw_Map_List.Name = "tvw_Map_List";
this.tvw_Map_List.Size = new System.Drawing.Size(165, 390);
this.tvw_Map_List.TabIndex = 3;
//
// pbx_Foothold_Render
//
this.pbx_Foothold_Render.Location = new System.Drawing.Point(184, 41);
this.pbx_Foothold_Render.Name = "pbx_Foothold_Render";
this.pbx_Foothold_Render.Size = new System.Drawing.Size(467, 390);
this.pbx_Foothold_Render.TabIndex = 4;
this.pbx_Foothold_Render.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(663, 443);
this.Controls.Add(this.pbx_Foothold_Render);
this.Controls.Add(this.tvw_Map_List);
this.Controls.Add(this.btn_OpenMapWz);
this.Controls.Add(this.tbx_Path);
this.Controls.Add(this.cbx_MapleType);
this.Name = "MainForm";
this.Text = "MainForm";
((System.ComponentModel.ISupportInitialize)(this.pbx_Foothold_Render)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox cbx_MapleType;
private System.Windows.Forms.TextBox tbx_Path;
private System.Windows.Forms.Button btn_OpenMapWz;
private System.Windows.Forms.TreeView tvw_Map_List;
private System.Windows.Forms.PictureBox pbx_Foothold_Render;
#endregion
private WzFile wzFile;
public MainForm()
{
InitializeComponent();
tbx_Path.Click += new EventHandler(tbx_Path_Click);
tvw_Map_List.NodeMouseClick += new TreeNodeMouseClickEventHandler(tvw_Map_List_NodeMouseClick);
cbx_MapleType.SelectedIndex = 0;
}
void tvw_Map_List_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (e.Node.Tag is WzImage)
{
WzImage img = (WzImage)e.Node.Tag;
if (!Directory.Exists("Renders\\" + img.Name.Substring(0, img.Name.Length - 4)))
Directory.CreateDirectory("Renders\\" + img.Name.Substring(0, img.Name.Length - 4));
SaveMap(img);
}
}
}
void SaveMap(WzImage img)
{
Size bmpSize;
Point center;
try
{
bmpSize = new Size(((WzCompressedIntProperty)((WzSubProperty)img["miniMap"])["width"]).Value, ((WzCompressedIntProperty)((WzSubProperty)img["miniMap"])["height"]).Value);
center = new Point(((WzCompressedIntProperty)((WzSubProperty)img["miniMap"])["centerX"]).Value, ((WzCompressedIntProperty)((WzSubProperty)img["miniMap"])["centerY"]).Value);
}
catch (KeyNotFoundException)
{
try
{
bmpSize = new Size(((WzCompressedIntProperty)((WzSubProperty)img["info"])["VRRight"]).Value - ((WzCompressedIntProperty)((WzSubProperty)img["info"])["VRLeft"]).Value, ((WzCompressedIntProperty)((WzSubProperty)img["info"])["VRBottom"]).Value - ((WzCompressedIntProperty)((WzSubProperty)img["info"])["VRTop"]).Value);
center = new Point(((WzCompressedIntProperty)((WzSubProperty)img["info"])["VRRight"]).Value, ((WzCompressedIntProperty)((WzSubProperty)img["info"])["VRBottom"]).Value);
//center = new Point(0, 0);
}
catch
{
return;
}
}
catch
{
return;
}
Bitmap mapRender = new Bitmap(bmpSize.Width, bmpSize.Height + 10);
using (Graphics drawBuf = Graphics.FromImage(mapRender))
{
//drawBuf.FillRectangle(new SolidBrush(Color.CornflowerBlue), 0, 0, bmpSize.Width, bmpSize.Height);
drawBuf.DrawString("Map " + img.Name.Substring(0, img.Name.Length - 4), new Font("Pragmata", 20), new SolidBrush(Color.Black), new PointF(10, 10));
try
{
drawBuf.DrawImage(((WzCanvasProperty)((WzSubProperty)img["miniMap"])["canvas"]).PngProperty.PNG, 10, 45);
}
catch (KeyNotFoundException)
{
drawBuf.DrawString("Minimap not availible", new Font("Pragmata", 18), new SolidBrush(Color.Black), new PointF(10, 45));
}
WzSubProperty fhs = (WzSubProperty)img["foothold"];
foreach (WzExtendedProperty fhspl0 in fhs.WzProperties)
foreach (WzExtendedProperty fhspl1 in ((WzSubProperty)fhspl0.ExtendedProperty).WzProperties)
foreach (WzExtendedProperty fhe in ((WzSubProperty)fhspl1.ExtendedProperty).WzProperties)
{
WzSubProperty fh = (WzSubProperty)fhe.ExtendedProperty;
int x = ((WzCompressedIntProperty)fh["x1"]).Value + center.X;
int y = ((WzCompressedIntProperty)fh["y1"]).Value + center.Y;
int width = ((((WzCompressedIntProperty)fh["x2"]).Value + center.X) - x);
int height = ((((WzCompressedIntProperty)fh["y2"]).Value + center.Y) - y);
if (width < 0)
{
x += width;// *2;
width = -width;
}
if (height < 0)
{
y += height;// *2;
height = -height;
}
if (width == 0 || width < 15)
width = 15;
height += 10;
drawBuf.FillRectangle(new SolidBrush(Color.FromArgb(95, Color.Gray.R, Color.Gray.G, Color.Gray.B)), x, y, width, height);
drawBuf.DrawRectangle(new Pen(Color.Black, 1F), x, y, width, height);
drawBuf.DrawString(fh.Name, new Font("Pragmata", 8), new SolidBrush(Color.Red), new PointF(x + (width / 2) - 8, y + (height / 2) - 7.7F));
}
}
mapRender.Save("Renders\\" + img.Name.Substring(0, img.Name.Length - 4) + "\\" + img.Name.Substring(0, img.Name.Length - 4) + "_footholdRender.bmp");
Bitmap tileRender = new Bitmap(bmpSize.Width, bmpSize.Height);
using (Graphics tileBuf = Graphics.FromImage(tileRender))
{
for (int i = 0; i < 7; i++)
{
if (((WzSubProperty)((WzSubProperty)img[i.ToString()])["info"]).WzProperties.Length == 0)
continue;
if (((WzSubProperty)((WzSubProperty)img[i.ToString()])["tile"]).WzProperties.Length == 0)
continue;
// Ok, we have some tiles and a tileset
string tileSetName = ((WzStringProperty)((WzSubProperty)((WzSubProperty)img[i.ToString()])["info"])["tS"]).Value;
// Browse to the tileset
WzImage tileSet = (WzImage)wzFile.GetObjectFromPath(wzFile.WzDirectory.Name + "/Tile/" + tileSetName + ".img");
foreach (WzExtendedProperty te in ((WzSubProperty)((WzSubProperty)img[i.ToString()])["tile"]).WzProperties)
{
WzSubProperty tile = (WzSubProperty)te.ExtendedProperty;
int x = ((WzCompressedIntProperty)tile["x"]).Value + center.X;
int y = ((WzCompressedIntProperty)tile["y"]).Value + center.Y;
string tilePackName = ((WzStringProperty)tile["u"]).Value;
string tileID = ((WzCompressedIntProperty)tile["no"]).Value.ToString();
Point origin = new Point(((WzVectorProperty)((WzCanvasProperty)((WzSubProperty)tileSet[tilePackName])[tileID])["origin"]).X.Value, ((WzVectorProperty)((WzCanvasProperty)((WzSubProperty)tileSet[tilePackName])[tileID])["origin"]).Y.Value);
tileBuf.DrawImage(((WzCanvasProperty)((WzSubProperty)tileSet[tilePackName])[tileID]).PngProperty.PNG, x - origin.X, y - origin.Y);
}
}
}
tileRender.Save("Renders\\" + img.Name.Substring(0, img.Name.Length - 4) + "\\" + img.Name.Substring(0, img.Name.Length - 4) + "_tileRender.bmp");
Bitmap fullBmp = new Bitmap(bmpSize.Width, bmpSize.Height + 10);
using (Graphics fullBuf = Graphics.FromImage(fullBmp))
{
fullBuf.FillRectangle(new SolidBrush(Color.CornflowerBlue), 0, 0, bmpSize.Width, bmpSize.Height + 10);
fullBuf.DrawImage(tileRender, 0, 0);
fullBuf.DrawImage(mapRender, 0, 0);
}
fullBmp.Save("Renders\\" + img.Name.Substring(0, img.Name.Length - 4) + "\\" + img.Name.Substring(0, img.Name.Length - 4) + "_fullRender.bmp");
pbx_Foothold_Render.Image = mapRender;
}
private void tbx_Path_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Map wz file|Map.wz|All wz files|*.wz|All files|*.*";
if (ofd.ShowDialog() != DialogResult.OK)
return;
tbx_Path.Text = ofd.FileName;
}
private void btn_OpenMapWz_Click(object sender, EventArgs e)
{
if (tbx_Path.Text == "")
return;
if (wzFile != null)
wzFile.Dispose();
wzFile = new WzFile(tbx_Path.Text, 65, (WzMapleVersion)cbx_MapleType.SelectedIndex);
wzFile.ParseWzFile();
tvw_Map_List.Nodes.Clear();
tvw_Map_List.Nodes.Add("Maps");
PopulateTreeView(tvw_Map_List.Nodes[0], (WzDirectory)wzFile.WzDirectory["Map"]);
tvw_Map_List.Sort();
}
private void PopulateTreeView(TreeNode node, WzDirectory dir)
{
foreach (WzDirectory subDir in dir.WzDirectories)
{
TreeNode dirNode = new TreeNode(subDir.Name);
PopulateTreeView(dirNode, subDir);
node.Nodes.Add(dirNode);
}
if (node.Text != "Maps")
foreach (WzImage img in dir.WzImages)
node.Nodes.Add(new TreeNode(img.Name) { Tag = img });
}
}
}
thats taken directly from the main thread. its an example...Example app using WzLib (it's a tile + foothold generator) :
[B]Code:[/B] WzFile.SaveToDisk(string Path);
This includes but is not limited to :
- Mass editing, such as adding notAttack to every monster
[B]Code:[/B] foreach (WzSubProperty info in wzFile.GetObjectsFromWildcardPath("Mob.wz/*.img/info")) info.AddProperty(new WzCompressedIntProperty("notAttack", 1));
- Changing the graphics of the game
- Adding new items, monsters for use in private servers
And the list goes on.
Error 1 The type or namespace name 'WzLib' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 6 7 Repacker
Error 2 The type or namespace name 'WzFile' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 133 17 Repacker
Error 3 The type or namespace name 'WzImage' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 157 22 Repacker
Error 4 The type or namespace name 'WzDirectory' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 285 54 Repacker
Error 1 The type or namespace name 'WzLib' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 6 7 Repacker
Error 2 The type or namespace name 'WzFile' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 133 17 Repacker
Error 3 The type or namespace name 'WzImage' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 157 22 Repacker
Error 4 The type or namespace name 'WzDirectory' could not be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsRyanLocal SettingsApplication DataTemporary ProjectsRepackerProgram.cs 285 54 Repacker