C# (Shop)

Results 1 to 15 of 15
  1. #1
    Banned Requnael is offline
    BannedRank
    Apr 2009 Join Date
    EstoniaLocation
    378Posts

    C# (Shop)

    Hello, how to i can add to here level
    http://forum.ragezone.com/f245/shop-...-zitem-643420/
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Xml;
    using System.Xml.XPath;
    using System.IO;
    using System.Text.RegularExpressions;
    
    namespace Gunz_Tool
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            String Dict;
            private String stringsparser(String Name, String dictionary)
            {
                XmlReader reader = XmlReader.Create(dictionary);
                String name= "";
                while (reader.Read())
                {
                    name = reader.GetAttribute(Name);
                }
                return name;
            }
            private void zitemparser(String dictionary)
            {
                richTextBox1.AppendText("<?xml version=" + a.Text + "1.0" + a.Text + "encoding=" + a.Text + "UTF-8" + a.Text + "?>" + Environment.NewLine + "<XML id=" + a.Text + "shop" + a.Text + ">" + Environment.NewLine);
                XmlReader reader = XmlReader.Create(dictionary);
                int i = 0;
                while (reader.Read())
                {
                    if (reader.Name.Equals("ITEM"))
                    {
                        String line = "<SELL itemid=" + a.Text;
                        int id = Convert.ToInt32(reader.GetAttribute("id"));
                        line += id + a.Text + "/> <!--";
                        String name = reader.GetAttribute("name");
                        name = Regex.Replace(name, "STR:", "");
                        name += a.Text;
                        if (reader.GetAttribute("name").Contains("STR:ZITEM_NAME_"))
                        {
                                        StreamReader file = null;
                                        String line1;
                                        file = new StreamReader(Dict + "Strings.xml");
                                        try
                                        {
                                            while ((line1 = file.ReadLine()) != null)
                                            {
                                                if (Regex.IsMatch(line1, name))
                                                {
                                                    String temp = Regex.Replace(line1, name, "");
                                                    temp = Regex.Replace(temp, "<", "");
                                                    temp = Regex.Replace(temp, ">", "");
                                                    temp = Regex.Replace(temp, "/", "");
                                                    temp = Regex.Replace(temp, a.Text, "");
                                                    temp = Regex.Replace(temp, "id", "");
                                                    temp = Regex.Replace(temp, "=", "");
                                                    temp = Regex.Replace(temp, "STR", "");
                                                    line += temp + "-->";
                                                }
                                            }
                                        }
                                        finally
                                        {
                                            if (file != null)
                                                file.Close();
                                        }
                        } else {
                            line += reader.GetAttribute("name") + a.Text + "-->";
                        }
                        if (!line.Contains("-->"))
                        {
                            line += "Not Found -->";
                        }
                        richTextBox1.AppendText(line + Environment.NewLine);
                        i++;
                    }
                }
                richTextBox1.AppendText("</XML>");
            }
    
            private void openToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Clear();
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Dict = Path.GetDirectoryName(openFileDialog1.FileName) + "\\";
                    zitemparser(openFileDialog1.FileName);
                }
            }
    
            private void saveToolStripMenuItem_Click(object sender, EventArgs e)
            {
                SaveFileDialog saveFile1 = new SaveFileDialog();
                saveFile1.DefaultExt = "shop.xml";
                saveFile1.Filter = "Shop|shop.xml";
                saveFile1.FileName = "shop.xml";
                if (saveFile1.ShowDialog() == DialogResult.OK)
                {
                    if (File.Exists(saveFile1.FileName))
                    {
                        File.Delete(saveFile1.FileName);
                    }
                    richTextBox1.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText);
                }
    
            }
            private void closeToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
    Last edited by Requnael; 03-12-12 at 04:54 PM.


  2. #2
    Account Upgraded | Title Enabled! ofiritsmeeee is offline
    MemberRank
    Sep 2011 Join Date
    274Posts

    Re: C++ (Shop)

    Here's an advice: stop using google translate and ask what do you want.

  3. #3
    Banned Requnael is offline
    BannedRank
    Apr 2009 Join Date
    EstoniaLocation
    378Posts

    Re: C++ (Shop)

    Are you kidding? this is not google translate. Here have desc for items. I want desc + Levels. how to do it!

  4. #4
    Account Upgraded | Title Enabled! ofiritsmeeee is offline
    MemberRank
    Sep 2011 Join Date
    274Posts

    Re: C++ (Shop)

    Shop.xml doesn't have Levels , only desc.
    Levels can be easily edit in zitem.xml

  5. #5
    Banned Requnael is offline
    BannedRank
    Apr 2009 Join Date
    EstoniaLocation
    378Posts

    Re: C++ (Shop)

    Quote Originally Posted by ofiritsmeeee View Post
    Shop.xml doesn't have Levels , only desc.
    Levels can be easily edit in zitem.xml
    Facepalm. Go away please. I know, what i ask here.

  6. #6
    Account Upgraded | Title Enabled! ofiritsmeeee is offline
    MemberRank
    Sep 2011 Join Date
    274Posts

    Re: C++ (Shop)

    Quote Originally Posted by Requnael View Post
    Facepalm. Go away please. I know, what i ask here.
    Fine , no help from my side from now.
    By the way , the code is written in C# -_-'

  7. #7
    Banned Requnael is offline
    BannedRank
    Apr 2009 Join Date
    EstoniaLocation
    378Posts

    Re: C++ (Shop)

    Explain better for all.

    Here is pic http://i45.tinypic.com/1r9hl2.jpg

    See <SELL itemid="*"/> <!-- Rusty Dagger --> i want <SELL itemid="*"/> <!-- Rusty Dagger --> <!-- LEVEL --> For easy setting shop

  8. #8
    Enthusiast RoyStyle is offline
    MemberRank
    Dec 2010 Join Date
    Holland :DLocation
    34Posts

    Re: C# (Shop)

    Why you need Level and desc in shop.xml?
    its already in zitem.xml
    and the easy way to set shop

    <SELL itemid="#" />
    Done :D

  9. #9
    人◕ ‿‿ ◕人 Forean is offline
    MemberRank
    Jul 2008 Join Date
    1,183Posts

    Re: C# (Shop)

    Everyone here is answering with stupid f***ing responces.

    @ofireitsmeee you shouldn't respond regaurdless.


    if (reader.Name.Equals("ITEM")) {
    String line = "<SELL itemid=" + a.Text;
    int id = Convert.ToInt32(reader.GetAttribute("id"));
    line += id + a.Text + "/> <!--";
    String name = reader.GetAttribute("name");
    name = Regex.Replace(name, "STR:", "");
    name += a.Text;
    if (reader.GetAttribute("name").Contains("STR:ZITEM_NAME_"))
    {
    StreamReader file = null;
    String line1;
    file = new StreamReader(Dict + "Strings.xml");
    try
    {
    while ((line1 = file.ReadLine()) != null)
    {
    if (Regex.IsMatch(line1, name))
    {
    String temp = Regex.Replace(line1, name, "");
    temp = Regex.Replace(temp, "<", "");
    temp = Regex.Replace(temp, ">", "");
    temp = Regex.Replace(temp, "/", "");
    temp = Regex.Replace(temp, a.Text, "");
    temp = Regex.Replace(temp, "id", "");
    temp = Regex.Replace(temp, "=", "");
    temp = Regex.Replace(temp, "STR", "");
    line += temp + "-->";
    }
    }
    }

    Take a look at that, shouldn't be to hard to write/copy a if/else statement

    That line shows the <!-- ITEM NAME --> , write it to grab the level from zitem also and have it do the same thing.

  10. #10
    Account Upgraded | Title Enabled! ofiritsmeeee is offline
    MemberRank
    Sep 2011 Join Date
    274Posts

    Re: C# (Shop)

    Quote Originally Posted by ForeanXz View Post
    Everyone here is answering with stupid f***ing responces.

    @ofireitsmeee you shouldn't respond regaurdless.





    Take a look at that, shouldn't be to hard to write/copy a if/else statement

    That line shows the <!-- ITEM NAME --> , write it to grab the level from zitem also and have it do the same thing.
    I know , but he can't respect peoples who trying to help him.
    Anyway , the code reads the name of the items from strings.xml which doesn't contains levels information .

  11. #11
    In Progress... FFXIV... Anju is offline
    MemberRank
    Oct 2010 Join Date
    Mist Ward 7 #38Location
    1,946Posts

    Re: C# (Shop)

    Quote Originally Posted by DoomReaper View Post
    lol google translate, learn english.
    Idiot

    Quote Originally Posted by ofiritsmeeee View Post
    I know , but he can't respect peoples who trying to help him.
    Anyway , the code reads the name of the items from strings.xml which doesn't contains levels information .
    Completely, a retard.

    Quote Originally Posted by ForeanXz View Post
    Everyone here is answering with stupid f***ing responces.

    @ofireitsmeee you shouldn't respond regaurdless.

    Take a look at that, shouldn't be to hard to write/copy a if/else statement

    That line shows the <!-- ITEM NAME --> , write it to grab the level from zitem also and have it do the same thing.
    This method is really easy as Forean said, ffs.

  12. #12
    Banned Requnael is offline
    BannedRank
    Apr 2009 Join Date
    EstoniaLocation
    378Posts

    Re: C# (Shop)

    Still not understand, i'm idiot. :D I all times get errors./

  13. #13
    Account Upgraded | Title Enabled! KeyTrix is offline
    MemberRank
    Feb 2012 Join Date
    EverywhereLocation
    268Posts

    Re: C# (Shop)

    Quote Originally Posted by Requnael View Post
    Still not understand, i'm idiot. :D I all times get errors./
    lol you gotta be kidding me Forean has just made it as simple and clear as possible for you.

    Make another line to work the same as <!-- ITEM NAME -->
    as simple as
    <!-- LEVEL -->
    Last edited by KeyTrix; 03-12-12 at 10:11 PM.

  14. #14
    Valued Member Kahazard is offline
    MemberRank
    Oct 2011 Join Date
    126Posts

    Re: C# (Shop)

    try
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Xml;
    using System.Xml.XPath;
    using System.IO;
    using System.Text.RegularExpressions;
    
    namespace Gunz_Tool
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            String Dict;
            private String stringsparser(String Name, String dictionary)
            {
                XmlReader reader = XmlReader.Create(dictionary);
                String name= "";
                while (reader.Read())
                {
                    name = reader.GetAttribute(Name);
                }
                return name;
            }
            private void zitemparser(String dictionary)
            {
                richTextBox1.AppendText("<?xml version=" + a.Text + "1.0" + a.Text + "encoding=" + a.Text + "UTF-8" + a.Text + "?>" + Environment.NewLine + "<XML id=" + a.Text + "shop" + a.Text + ">" + Environment.NewLine);
                XmlReader reader = XmlReader.Create(dictionary);
                int i = 0;
                while (reader.Read())
                {
                    if (reader.Name.Equals("ITEM"))
                    {
                        String line = "<SELL itemid=" + a.Text;
                        int id = Convert.ToInt32(reader.GetAttribute("id"));
    					int lvl = Convert.ToInt32(reader.GetAttribute("res_level"));
                        line += id + a.Text + "/>"+ "<!-- LEVEL: "+  lvl + " --> <!--";
                        String name = reader.GetAttribute("name");
                        name = Regex.Replace(name, "STR:", "");
                        name += a.Text;
                        if (reader.GetAttribute("name").Contains("STR:ZITEM_NAME_"))
                        {
                                        StreamReader file = null;
                                        String line1;
                                        file = new StreamReader(Dict + "Strings.xml");
                                        try
                                        {
                                            while ((line1 = file.ReadLine()) != null)
                                            {
                                                if (Regex.IsMatch(line1, name))
                                                {
                                                    String temp = Regex.Replace(line1, name, "");
                                                    temp = Regex.Replace(temp, "<", "");
                                                    temp = Regex.Replace(temp, ">", "");
                                                    temp = Regex.Replace(temp, "/", "");
                                                    temp = Regex.Replace(temp, a.Text, "");
                                                    temp = Regex.Replace(temp, "id", "");
                                                    temp = Regex.Replace(temp, "=", "");
                                                    temp = Regex.Replace(temp, "STR", "");
                                                    line += temp + "-->";
                                                }
                                            }
                                        }
                                        finally
                                        {
                                            if (file != null)
                                                file.Close();
                                        }
                        } else {
                            line += reader.GetAttribute("name") + a.Text + "-->";
                        }
                        if (!line.Contains("-->"))
                        {
                            line += "Not Found -->";
                        }
                        richTextBox1.AppendText(line + Environment.NewLine);
                        i++;
                    }
                }
                richTextBox1.AppendText("</XML>");
            }
    
            private void openToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Clear();
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Dict = Path.GetDirectoryName(openFileDialog1.FileName) + "\\";
                    zitemparser(openFileDialog1.FileName);
                }
            }
    
            private void saveToolStripMenuItem_Click(object sender, EventArgs e)
            {
                SaveFileDialog saveFile1 = new SaveFileDialog();
                saveFile1.DefaultExt = "shop.xml";
                saveFile1.Filter = "Shop|shop.xml";
                saveFile1.FileName = "shop.xml";
                if (saveFile1.ShowDialog() == DialogResult.OK)
                {
                    if (File.Exists(saveFile1.FileName))
                    {
                        File.Delete(saveFile1.FileName);
                    }
                    richTextBox1.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText);
                }
    
            }
            private void closeToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
    changes:
    Code:
    int lvl = Convert.ToInt32(reader.GetAttribute("res_level"));
    line += id + a.Text + "/>"+ "<!-- LEVEL: "+  lvl + " --> <!--";

  15. #15
    Banned Requnael is offline
    BannedRank
    Apr 2009 Join Date
    EstoniaLocation
    378Posts

    Re: C# (Shop)

    Work, ty. Now i know, how to do it. :P Topic closed!!



Advertisement