Warp gate edİtor

  • Konbuyu başlatan Konbuyu başlatan spaeders
  • Başlangıç tarihi Başlangıç tarihi
Konu Yazar

spaeders

AssaSİNS
May
112
1
Arkadaslar benİm gİbİ bİr cok arkadasimizinda sİtede aradigi warp gate edİtoru bulmus durumdayim ve sİzlerle paylasmak İstİyorum.umarim İŞİnİzİ gormus olurum
 

Ekli dosyalar

Cevap: Re: Warp gate edİtor

bendende c# kodları

Kod:
        public bool LoadMap(string filename)
        {
            if (this.m_changed)
            {
                switch (MessageBox.Show("Changes to the warp list have been made, do you want to save?", "Warp Gate Editor", MessageBoxButtons.YesNoCancel))
                {
                    case DialogResult.Cancel:
                        return true;

                    case DialogResult.Yes:
                        this.SaveMap();
                        break;
                }
            }
            try
            {
                this.m_warpgates.Clear();
                this.lbWarpList.Items.Clear();
                this.ClearEditPane();
                this.m_changed = false;
                FileStream input = File.Open(filename, FileMode.Open);
                BinaryReader reader = new BinaryReader(input);
                long offset = 0L;
                int num2 = reader.ReadInt32();
                reader.ReadInt32();
                offset = (num2 * num2) * 4;
                reader.BaseStream.Seek(offset, SeekOrigin.Current);
                offset = 0L;
                float num3 = reader.ReadSingle();
                float num4 = reader.ReadSingle();
                int num5 = reader.ReadInt32();
                if (num5 > 0)
                {
                    int num6 = (12 * num5) * 3;
                    for (int i = 0; i < num6; i++)
                    {
                        reader.ReadByte();
                    }
                }
                int num8 = 0;
                float num9 = 0f;
                while (num9 < num4)
                {
                    int num10 = 0;
                    float num11 = 0f;
                    while (num11 < num3)
                    {
                        if (((reader.ReadInt32() == 0) ? 0 : 1) != 0)
                        {
                            int num12 = reader.ReadInt32();
                            if (num12 > 0)
                            {
                                for (int k = 0; k < (num12 * 2); k++)
                                {
                                    reader.ReadByte();
                                }
                            }
                            for (int j = 0; j < 4; j++)
                            {
                                for (int m = 0; m < 4; m++)
                                {
                                    int num16 = reader.ReadInt32();
                                    if (num16 > 0)
                                    {
                                        for (int n = 0; n < ((num16 * 3) * 4); n++)
                                        {
                                            reader.ReadByte();
                                        }
                                    }
                                }
                            }
                        }
                        num11 += 16f;
                        num10++;
                    }
                    num9 += 16f;
                    num8++;
                }
                int num18 = reader.ReadInt32();
                offset = 0x18 * num18;
                reader.BaseStream.Seek(offset, SeekOrigin.Current);
                offset = num2 * (num2 * 2);
                reader.BaseStream.Seek(offset, SeekOrigin.Current);
                int num19 = reader.ReadInt32();
                offset = 20 * num19;
                reader.BaseStream.Seek(offset, SeekOrigin.Current);
                this.m_mapDataSize = (int) reader.BaseStream.Position;
                int num20 = reader.ReadInt32();
                if (num20 == 0)
                {
                    MessageBox.Show("This map file doesn't have any warp gates.", "Warp Gate Editor");
                }
                else
                {
                    int num21 = ((int) (reader.BaseStream.Length - reader.BaseStream.Position)) / 0x138;
                    if (num21 != num20)
                    {
                        num20 = num21;
                    }
                    try
                    {
                        for (int num22 = 0; num22 < num20; num22++)
                        {
                            WarpGate item = new WarpGate();
                            item.ID = reader.ReadInt16();
                            item.Name = Encoding.Default.GetString(reader.ReadBytes(0x20));
                            item.Announce = Encoding.Default.GetString(reader.ReadBytes(0x100)).Trim();
                            reader.ReadInt16();
                            item.Pay = reader.ReadInt32();
                            item.Zone = reader.ReadInt32();
                            item.X = reader.ReadSingle();
                            item.Y = reader.ReadSingle();
                            item.Z = reader.ReadSingle();
                            item.R = reader.ReadSingle();
                            item.Nation = reader.ReadByte();
                            item.Unknown = reader.ReadByte();
                            reader.ReadInt16();
                            this.m_warpgates.Add(item);
                            this.lbWarpList.Items.Add(((item.Nation == 1) ? "ORC" : "HUM") + "\t" + item.Name);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                input.Close();
                this.m_fileName = filename;
                string[] strArray = filename.Split(new char[] { '\\' });
                this.lblFile.Text = strArray[strArray.Length - 1];
                this.m_loaded = true;
                return true;
            }
            catch (Exception exception)
            {
                if (this.m_warpgates.Count != 0)
                {
                    MessageBox.Show(string.Format("There was an error while reading the warp gate segment, exception = {0}", exception), "Warp Gate Editor Error");
                    return true;
                }
                MessageBox.Show(exception.ToString());
                this.lblFile.Text = string.Empty;
                this.m_loaded = false;
                return false;
            }
        }

Kod:
        public void SaveMap()
        {
            if (!this.m_loaded)
            {
                MessageBox.Show("You haven't loaded a map file yet!", "Warp Gate Editor");
            }
            else if (!this.m_changed)
            {
                MessageBox.Show("Nothing has changed since load.", "Warp Gate Editor");
            }
            else
            {
                try
                {
                    FileStream input = File.Open(this.m_fileName, FileMode.Open, FileAccess.ReadWrite);
                    BinaryReader reader = new BinaryReader(input);
                    byte[] buffer = new byte[this.m_mapDataSize];
                    reader.Read(buffer, 0, this.m_mapDataSize);
                    input.Close();
                    input = File.Open(this.m_fileName, FileMode.Truncate, FileAccess.Write);
                    BinaryWriter writer = new BinaryWriter(input);
                    writer.Write(buffer, 0, buffer.Length);
                    try
                    {
                        writer.Seek(this.m_mapDataSize, SeekOrigin.Begin);
                        writer.Write(this.m_warpgates.Count);
                        for (int i = 0; i < this.m_warpgates.Count; i++)
                        {
                            WarpGate gate = this.m_warpgates[i];
                            writer.Write(gate.ID);
                            byte[] bytes = new byte[0x20];
                            Encoding.Default.GetBytes(gate.Name, 0, gate.Name.Length, bytes, 0);
                            writer.Write(bytes);
                            byte[] buffer3 = new byte[0x100];
                            Encoding.Default.GetBytes(gate.Announce, 0, gate.Announce.Length, buffer3, 0);
                            writer.Write(buffer3);
                            writer.Write((short) 0);
                            writer.Write(gate.Pay);
                            writer.Write(gate.Zone);
                            writer.Write(gate.X);
                            writer.Write(gate.Y);
                            writer.Write(gate.Z);
                            writer.Write(gate.R);
                            writer.Write(gate.Nation);
                            writer.Write(gate.Unknown);
                            writer.Write((short) 0);
                        }
                        input.Close();
                        this.m_changed = false;
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(string.Format("Unable to save to SMD with the error: {0}", exception.ToString()), "Warp Gate Editor");
                    }
                }
                catch
                {
                    MessageBox.Show("Unable to re-open the SMD file for writing.", "Warp Gate Editor");
                }
            }
        }

Kod:
        public struct WarpGate
        {
            public short ID;
            public string Name;
            public string Announce;
            public int Pay;
            public int Zone;
            public float X;
            public float Y;
            public float Z;
            public float R;
            public byte Nation;
            public byte Unknown;
        }
 
Cevap: Warp gate edİtor

eline koluna saglk işime yaradı
 
Geri
Üst Alt